Adding the Corvidae Pixel to your Android apps
The Corvidae Pixel is a library for recording user activity into the Corvidae Platform for a Android 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)
Kotlin SDK
No initialisation is required for the Kotlin 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:
import ai.corvidae.pixel.Corvidae
val json = """
{
"appId": "test", // Your Client ID
"hostname": "test.corvidae.ai"
"url": "https://appandroid.corvidae.ai/home",
"digitalProperty": "android-app",
"event": "pv",
"page": "Home Screen",
}
"""
Corvidae.track(json) { success, error ->
if (success) {
// Handle success
Log.d("TrackEvent", "Event tracking was successful")
} else {
// Handle error
error?.let { Log.e("TrackEvent", "Error tracking event: $it") }
}
}
Conversions
The following example shows how to record a transaction using thee Kotlin SDK:
import ai.corvidae.pixel.Corvidae
val json = """
{
"appId": "test", // Your Client ID
"hostname": "test.corvidae.ai"
"url": "https://appandroid.corvidae.ai/home",
"digitalProperty": "android-app",
"event": "tr",
"transactionType": "orderConfirmation",
"transactionAmount": 123.50,
"page": "Payment Screen"
}
"""
Corvidae.track(json) { success, error ->
if (success) {
// Handle success
Log.d("TrackEvent", "Event tracking was successful")
} else {
// Handle error
error?.let { Log.e("TrackEvent", "Error tracking event: $it") }
}
}
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 parmeters 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
{
"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
{
"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
{
"appId": "test", // Your Client ID
"hostname": "test.corvidae.ai",
"url": "https://appios.corvidae.ai/payment",
"event": "tr",
"transactionType": "appPayment1",
"page": "Payment Screen"
}
Alternatively
{
"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
{
"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
{
"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.