Android SDK

The Velocidi Android SDK is open-source and can be found at github.com/velocidi/velocidi-android-sdk.

Installation#

Velocidi SDK is published to Maven central as a single module. Please reference the badge above or go to the release page to check our latest version.

To install the SDK in your application you just need to add the following dependency to the app/build.gradle file.

dependencies {
implementation 'com.velocidi:velocidi-android-sdk:0.2.0'
}

You also need to add the following permissions to ensure the good functioning of the SDK.

In your application AndroidManifest.xml:

<!-- Required for internet. -->
<uses-permission android:name="android.permission.INTERNET"/>

In your build.gradle file:

dependencies {
implementation 'com.google.android.gms:play-services-ads-identifier:16.0.0'
}

Setting up the SDK#

We highly recommend initializing the SDK on the onCreate method in your Application subclass. If you don't already have an Application subclass, you can also instantiate it in your MainActivity although it is not recommended.

class SampleApplication : Application() {
override fun onCreate() {
super.onCreate()
val config = Config(URL("https://cdp.test.com"))
Velocidi.init(config, this)
}
}

You can also have a more granular control over the supported channels:

class SampleApplication : Application() {
override fun onCreate() {
super.onCreate()
val trackEndpoint = Channel(URL("https://tr.cdp.test.com"), true)
val matchEndpoint = Channel(URL("https://match.cdp.test.com"), true)
val config = Config(trackEndpoint, matchEndpoint)
Velocidi.init(config, this)
}
}

Send a track event#

The track method allows you to collect user activity performed in your application. This method is expecting a tracking event with the event details. For more information check our documentation.

Velocidi.getInstance().track(PageView("MobileApp", "client1"))

It also accepts custom tracking events in a JSON format. Custom events should have type "custom" and a field "customType" with their custom event type:

val event =
"""
{
"type": "custom",
"customType": "customType",
"siteId": "MobileApp",
"clientId": "client1"
}
""".trimIndent()
Velocidi.getInstance().track(CustomTrackingEventFactory.buildFromJSON(event))

Make a match#

The match method allows you to identify a user across multiple channels. Internally, the SDK is identifying a user based on its Advertising ID. By performing a match between an Advertising ID and your custom ID (e.g. e-mail hashes or CRM IDs), you are telling Velocidi CDP that these are the same user and all the information retrieved with either one of these IDs belongs to the same user.

// Match the device Advertising ID with the user email(useremail@example.com)
Velocidi.match("someProvider", listOf(UserId("eml", "useremail@example.com")))

For more information our documentation section on Cross-Channel Matches

Available tracking events model classes#

  • AddToCart
  • AppView
  • OrderPlace
  • PageView
  • ProductClick
  • ProductCustomization
  • ProductFeedback
  • ProductImpression
  • ProductView
  • ProductViewDetails
  • RemoveFromCart
  • Search
Last updated on