Skip to content

Axon Pixel Mobile App Integration

This guide shows how to integrate the Axon SDK into your native Android mobile app so that you can track events for that app.

Download the Latest SDK

You can download the SDK through Gradle as a dependency. The SDK requires the minSdkVersion to be 19 or above.

Add the following to your app-level build.gradle file:

repositories {
google()
mavenCentral()
}
dependencies {
implementation 'com.applovin:axon-sdk:+'
}

ProGuard Rules

If you use ProGuard, note that the AppLovin Axon SDK comes bundled with the required ProGuard rules in the AARs. Therefore, you do not need to add any additional ProGuard rules to your project.

Initialize the SDK

Initialize the AxonSDK with the event key at startup to maximize how long the SDK can take to ready core services. Replace “«your-event-key»” with your Axon Event Key.

You can find your Axon Event Key in the Account > General > Keys section of the AppLovin dashboard.

import com.applovin.sdk.Axon;
Axon.getInstance().initialize( "«your-event-key»", new Axon.InitializationListener()
{
@Override
public void onInitialized()
{
}
} );

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.

@Override
protected void onNewIntent(final Intent intent)
{
super.onNewIntent( intent );
if ( Intent.ACTION_VIEW.equals( intent.getAction() ) )
{
final Uri uri = intent.getData();
if ( uri != null )
{
Axon.getInstance().processDeepLink( uri );
}
}
}

Tracking Events with the Axon SDK

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» );

Parameters

NameTypeDescription
event_namestringThe name for this event. See Axon Pixel Events and Objects for available events.
event_dataobjectThe 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.

Passing Data to the Axon SDK

For each of the events that requires event_data, AppLovin 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 );