Skip to main content
Skip table of contents

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:

KOTLIN
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:

KOTLIN
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

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

transactionType

Transaction value

tax

Transaction tax

shipping

Transaction shipping

currency

Transaction currency

JavaScript errors detected

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

If this problem persists, please contact our support.