Analytics
For analytics, the 101XP SDK uses AppsFlyer, 101XP Analytics (a ClickHouse-based implementation) and Firebase Analytics.
Configure
101XP Analytics
Add the following values to your Info.plist.
Please ask your manager for those values.
P101XPAnalyticsProjectId - Analytics Project Id for the production environment
P101XPAnalyticsProjectIdDev - Analytics Project Id for the sandbox environment (so you do not need to change it and it can always be 10000)
<key>P101XPAnalyticsProjectId</key>
<string>YOUR_AnalyticsProjectId</string>
<key>P101XPAnalyticsProjectIdDev</key>
<string>10000</string>
NSUserTrackingUsageDescription - the text of first (system) IDFA request window
<key>NSUserTrackingUsageDescription</key>
<string>This identifier will be used to deliver personalized ads to you.</string>
AppsFlyer
Add the following values to your Info.plist.
Please ask your manager for those values.
P101XPAppsFlyerDevKey - Developer Key of the project in AppsFlyer
P101XPAppsFlyerAppleAppId - Apple Project ID
P101XPAppsFlyerUseUninstallSandbox - If you need to use the sandbox environment to track the deletion events (true/false)
<key>P101XPAppsFlyerDevKey</key>
<string>INSERT_DEV_KEY</string>
<key>P101XPAppsFlyerAppleAppId</key>
<string>INSERT_APPLE_APP_ID</string>
<key>P101XPAppsFlyerUseUninstallSandbox</key>
<false/>
Enabling push notifications
To track deletion events, you must enable push notification in XCode:
Usage
Installation event
To track the installation event it is enough to call applicationDidBecomeActive in the corresponding method.
- (void)applicationDidBecomeActive:(UIApplication *)application {
[P101XP applicationDidBecomeActive:application];
}
Deletion event
To track deletion events, you need to call didRegisterForRemoteNotificationsWithDeviceToken in the corresponding method. In this case, as described above, push notification should be enabled.
- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
[P101XP didRegisterForRemoteNotificationsWithDeviceToken:application deviceToken:deviceToken];
}
Sending events
Use the analyticsTrack method to send events. Any values associated with the event can be passed through NSDictionary.
[P101XP analyticsTrack:@"test" withValues:@{ @"test": @"value" }];
To turn off sending events to AppsFlyer, add a value to Info.plist:
<key>P101XPAppsFlyerTrackEnabled</key>
<false/>
Conversion data
If you need to get conversion data from appsflyer, you need to implement the delegate method p101xpOnGetAnalyticsConversionData:
- (void)p101xpOnGetAnalyticsConversionData:(NSDictionary *)data;
Event names
Use the following names for sending events:
Event name | Attributes | Event description |
---|---|---|
af_login | "player_id":"xxxxx", where xxxxx - character/in-game account ID | Used to track users login events (login to the server) |
af_level_achieved | "af_level":"x", where X - Lvl gained by a character | Used to track a level achieved |
af_tutorial_completion | "player_id":"xxxxx", where xxxxx - character/in-game account ID | Used to track tutorial completions |
Example of sending af_login event from the table:
[P101XP analyticsTrack:@"af_login" withValues:@{@"player_id" : your_player_id,
@"player_name" : your_player_name,
@"server_id" : your_server_id}];
Do not use user_id and mobile_id as attributes, as they are used by 101XP Mobile SDK.
Conversion data
To get the conversion data for AppsFlyer use the next delegate method of P101XPDelegate:
(void)p101xpOnGetAnalyticsConversionData:(NSDictionary *)data;