This guide shows how to integrate the Axon SDK into your native iOS 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 CocoaPods as a dependency.
The SDK requires the minimum iOS deployment target to be iOS 12.0 or above. It also requires Xcode version 15 or above.
To integrate the AxonSDK through CocoaPods:
Add the following line to your Podfile:
pod 'AxonSDK'
Run the following on the command line:
pod install --repo-update
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 AxonSDK
let initConfig = ALAxonInitializationConfiguration(key: "«your-key»")
Axon.shared.initialize(with: initConfig) {
⋮
}#import <AxonSDK/AxonSDK.h>
ALAxonInitializationConfiguration *initConfig = [ALAxonInitializationConfiguration configurationWithKey: @"«your-key»"];
[ALAxon.shared initializeWithConfiguration: initConfig completionHandler:^{
⋮
}];
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 app delegate, call Axon SDK’s processDeepLink: API to handle inbound deep links and associated metadata.
Axon only processes URLs that originate from Axon.
func application(_ application: UIApplication,
continue userActivity: NSUserActivity,
restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void) -> Bool
{
guard userActivity.activityType == NSUserActivityTypeBrowsingWeb,
let url = userActivity.webpageURL else
{
return true
}
// Pass deep link URL to Axon SDK in order to potentially reattribute the user
Axon.shared.processDeepLink(url)
return true
}- (BOOL)application:(UIApplication *)application
continueUserActivity:(NSUserActivity *)userActivity
restorationHandler:(void (^)(NSArray<id<UIUserActivityRestoring>> *restorableObjects))restorationHandler
{
if ( ![userActivity.activityType isEqualToString: NSUserActivityTypeBrowsingWeb] ) return YES;
// Pass deep link URL to Axon SDK in order to potentially reattribute the user
[ALAxon.shared processDeepLink: userActivity.webpageURL];
return YES;
}
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.eventService.track(event: «event-name», parameters: «event-data»)[sdk.eventService trackEvent: «event-name» withParameters: «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 dictionary that is the payload.
For example:
sdk.eventService.track(event: "add_to_cart", parameters: [
"currency" : "USD",
"value" : 99.99,
"items" : [
⋮
]
])[sdk.eventService trackEvent: @"add_to_cart" parameters: @{
@"currency" : @"USD",
@"value" : @(99.99),
@"items" : @[
⋮
]
}];
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 IDFAs, pass a list of test device advertising IDs in the Axon SDK initialization configuration. The following code snippets show how to do this:
let initConfig = ALAxonInitializationConfiguration(eventKey: "«your-key»" ) { builder in
builder.testDeviceAdvertisingIdentifiers = ["«your-IDFA»"]
}ALAxonInitializationConfiguration *initConfig = [ALAxonInitializationConfiguration configurationWithEventKey: @"«your-key»"
builderBlock:^(ALAxonInitializationConfigurationBuilder *builder) {
builder.testDeviceAdvertisingIdentifiers = @[@"«your-IDFA»"];
}];
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.


Axon.shared.isDebuggerEnabled = true
Axon.shared.initialize(with: config) { }[[ALAxon shared] setDebuggerEnabled:YES];
[[ALAxon shared] initializeWithConfiguration:config completionHandler:^{ }];