This guide shows how to integrate the Axon SDK into your native Android mobile app so that you can track events for that app.
You can download the SDK through Gradle as a dependency.
The SDK requires the minSdkVersion to be 23 or above.
Add the following to your app-level build.gradle file:
If you use ProGuard, note that the Axon SDK comes bundled with the required ProGuard rules in the AARs. You do not need to add more ProGuard rules to your project.
Initialize the AxonSDK with the event or SDK key at startup to maximize how long the SDK can take to ready core services.
Replace “«your-key»” with your Axon event or SDK Key.
You can find your Axon event key in the Account > General > Keys section of the AppLovin dashboard.
You must provide a deep link so that when a user clicks an ad, either your app seamlessly opens if it is installed, or the click routes them to a browser otherwise.
In your Activity that handles the deep link, call Axon SDK’s processDeepLink() API to handle inbound deep links and associated metadata.
To send an occurrence of an ecommerce event to Axon, use the following syntax. Each event should trigger when its corresponding event happens in the data layer.
| Name | Type | Description |
|---|---|---|
event_name | string | The name for this event. See Axon Pixel events and objects for available events. |
event_data | object | The data for this event. See Axon Pixel events and objects for data to send. (Note: you do not need to send event_data with page_view.) |
All events require the event_name argument.
Each event except for page_view also requires certain event_data, described in the event-specific sections below.
For each of the events that requires event_data, Axon recommends that you create a Map that is the payload.
For example:
When you test your integration, it’s important that you prevent test events from affecting your production data.
To enable test mode for a set of GAIDs, pass a list of test device advertising IDs in the Axon SDK initialization configuration. The following code snippets show how to do this:
SDK integration is in beta and is only available in certain regions.
The SDK collects the Google Advertising ID.
This requires the Android Advertising ID (AAID) module (com.google.android.gms:play-services-ads-identifier).
See Google Play services dependencies.
Axon only processes URLs that originate from Axon.
At a minimum, provide page_view, view_item, add_to_cart, begin_checkout, and purchase events.
Also include sign_up or login if your site uses these events.