This guide shows how to integrate the Axon SDK into your native Android mobile app so that you can track events for that app.
SDK integration is in beta and is only available in certain regions.
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:
repositories {
google()
mavenCentral()
⋮
}
dependencies {
implementation 'com.applovin:axon-sdk:+'
⋮
}
repositories {
google()
mavenCentral()
⋮
}
dependencies {
implementation("com.applovin:axon-sdk:+")
⋮
}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.
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.
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.
import com.applovin.sdk.Axon;
AxonInitializationConfiguration initConfig = AxonInitializationConfiguration.builder( "«your-key»" ).build();
Axon.getInstance( /* Context */ this ).initialize( initConfig, new Axon.InitializationListener()
{
@Override
public void onInitialized()
{
⋮
}
} );import com.applovin.sdk.Axon
val initConfig = AxonInitializationConfiguration.builder("«your-key»").build()
Axon.getInstance(/* Context */ this).initialize(initConfig) {
⋮
})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.
Axon only processes URLs that originate from Axon.
@Override
protected void onCreate(@Nullable final Bundle savedInstanceState)
{
super.onCreate( savedInstanceState );
⋮
processIntent( getIntent() );
}
@Override
protected void onNewIntent(final Intent intent)
{
super.onNewIntent( intent );
⋮
processIntent( intent );
}
private void processIntent(final Intent intent)
{
⋮
if ( Intent.ACTION_VIEW.equals( intent.getAction() ) )
{
final Uri uri = intent.getData();
if ( uri != null )
{
Axon.getInstance( this ).processDeepLink( uri );
}
}
}override fun onCreate(savedInstanceState: Bundle?)
{
super.onCreate(savedInstanceState)
⋮
processIntent(intent)
}
override fun onNewIntent(intent: Intent?)
{
super.onNewIntent(intent)
⋮
processIntent(intent)
}
private fun processIntent(intent: Intent?)
{
⋮
if (intent?.action == Intent.ACTION_VIEW)
{
intent.data?.let { uri -> Axon.getInstance(this).processDeepLink(uri) }
}
}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.
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.
sdk.getEventService().trackEvent( «event-name», «event-data» );
sdk.eventService.trackEvent(«event-name», «event-data»)| 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:
Map<String, Object> parameters = new HashMap<>();
parameters.put( "currency", "USD" );
parameters.put( "value", 99.99 );
List<Map<String, Object>> items = new ArrayList<>();
⋮
parameters.put( "items", items );
sdk.getEventService().trackEvent( "add_to_cart", parameters );sdk.eventService.trackEvent("add_to_cart", mapOf(
"currency" to "USD",
"value" to 99.99,
"items" to listOf(
⋮
)
))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:
AxonInitializationConfiguration configuration = AxonInitializationConfiguration.builder( "«your-key»" )
.setTestDeviceAdvertisingIds( Arrays.asList( "«your-GAID»" ) )
.build();val initConfig = AxonInitializationConfiguration.builder("«your-key»")
.setTestDeviceAdvertisingIds(listOf("«your-GAID»"))
.build()The Debugger helps you test tracking events and verify your integration. Enable the Debugger before you initialize the SDK.
After initialization completes, the application displays an Axon button (
) as a persistent floating icon on the screen.
This icon remains visible throughout the current application session and typically persists across different screens.
Click this button to open the Debugger.
The Debugger displays the current integration status and the events that your application reports. Use this information to confirm that your implementation sends events correctly.


The following code example shows how to enable the Debugger:
Axon.getInstance(this).setDebuggerEnabled(true);
Axon.getInstance(this).initialize(config, listener);Axon.getInstance(this).setDebuggerEnabled(true)
Axon.getInstance(this).initialize(config) { }