Skip to main content
Skip table of contents

Adding the Corvidae Pixel to your Apple Apps

The Corvidae Pixel is a library for recording user activity into the Corvidae Platform for iOS or iPadOS applications.

Requirements

To use the Corvidae Pixel, you’ll first need the following which will be provided by your Account Manager:

  • A client ID (passed as appId)

Swift SDK

No initialisation is required for the Swift SDK, you can simply call the .track() function and pass in any parameters for recording into the Corvidae platform.

Screen Views

This Screen View pixel must be implemented on every screen of your mobile application.

The example below shows how to record a screen/page view:

SWIFT
import Corvidae
let jsonString = """
{
    "appId": "test", // Your Client ID
    "hostname": "test.corvidae.ai",
    "url": "https://appios.corvidae.ai/home",
    "digitalProperty": "ios-app",
    "event": "pv",
    "page": "Home Screen",
}
"""
Corvidae.track(json: jsonString) { success, error in
    DispatchQueue.main.async {
        if success {
            print("Event posted successfully.")
        } else {
            print("Failed to post event:", error ?? "Unknown error")
        }
    }
}

Conversions

The following example shows how to record a transaction:

SWIFT
import Corvidae
let jsonString = """
{
    "appId": "test", // Your Client ID
    "hostname": "test.corvidae.ai"
    "url": "https://appios.corvidae.ai/home",
    "digitalProperty": "ios-app",
    "event": "tr",
    "transactionType": "orderConfirmation",
    "transactionTotal": 123.50,
    "page": "Payment Screen"
}
"""
Corvidae.track(json: jsonString) { success, error in
    DispatchQueue.main.async {
        if success {
            print("Event posted successfully.")
        } else {
            print("Failed to post event:", error ?? "Unknown error")
        }
    }
}

Parameters

Universal Parameters

The following list shows all of the parameters that can be passed to both the web and SDK Pixels. These parameters are automatically collected where available, but can be overwritten by manually passing them into the Pixel payload.

Parameter

Description

timestamp

Timestamp when event was sent by client device to collector

event

tr = transaction, pv = pageview tracking, im = impression tracking

url

Page URL is a custom field used to identify the page/screen, e.g. domain/home within the app, which is used as a description from where the information is tracked.

digitalProperty

A unique name to identify the website or application

page

Page Title

referrer

Referrer URL

trackerVersion

Identifier for Pixel version

trackerName

Tracker namespace

appId

Unique account identifier

platform

Platform the app runs on

timezone

Time zone of the client OS

language

Browser language

characterSet

Charcter encoding

resolution

Screen monitor resolution

cookie

Does the browser permit cookies

eventID

Event UUID

timestamp

Timestamp when event was recordered

viewport

Browser viewport width and height

documentSize

Web page width and height

visitorId

Index of number of visits this user_id has made to this domain

sessionId

Unique Identifier (UUID) for this visit of this user_id to this domain

userId

Unique Identifier (UUID) for this user

Transaction Parameters

The following parameters can also be used when the event type is a transaction (event=tr).

Parameter

Description

event

tr = transaction

transactionId

Transaction order ID

transactionTotal

Transaction value

transactionType

Type of conversion

tax

Transaction tax

shipping

Transaction shipping

currency

Transaction currency

Further Examples

For additional clarity, please refer to the examples below.

 Transaction Type: appDownload

JS
{
  "appId": "test", // Your Client ID
  "hostname": "test.corvidae.ai",
  "url": "https://appios.corvidae.ai/home",
  "event": "tr",
  "transactionType": "appDownload",
  "page": "Welcome Screen"
}

Transaction Type: appRegistration

JS
{
  "appId": "test", // Your Client ID
  "hostname": "test.corvidae.ai",
  "url": "https://appios.corvidae.ai/register",
  "event": "tr",
  "transactionType": "appRegistration",
  "page": "Registration Screen"
}

 Transaction Type: appPayment 

JS
{
  "appId": "test", // Your Client ID
  "hostname": "test.corvidae.ai",
  "url": "https://appios.corvidae.ai/payment",
  "event": "tr",
  "transactionType": "appPayment1",
  "page": "Payment Screen"
}

Alternatively

JS
{
  "appId": "test", // Your Client ID
  "hostname": "test.corvidae.ai",
  "url": "https://appios.corvidae.ai/payment",
  "event": "tr",
  "transactionType": "appPayment1",
  "transactionTotal": 123.50,
  "page": "Payment Screen"
  }

Or

JS
{
  "appId": "test", // Your Client ID
  "hostname": "test.corvidae.ai",
  "url": "https://appios.corvidae.ai/payment",
  "event": "tr",
  "transactionType": "appPayment1",
  "transactionTotal": 123.50,
  "transactionTax": 24.70,
  "transactionShipping": 0.00,
  "page": "Payment Screen"
}

Transaction Type: appDownload

JS
{
    "appId": "test", // Your Client ID
    "hostname": "test.corvidae.ai",
    "url": "https://appios.corvidae.ai/payment",
    "event": "tr",
    "transactionType": "appDownload",
    "page": "Downlaod Screen"
}

Additional Resources

To see more documentation, select a chapter from the navigation sidebar on the left.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.