Analytics
For analytics, the 101XP SDK uses Adjust, 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>
Enabling push notifications
To track deletion events, you must enable push notification in XCode:
Adjust
Add the P101XPAdjustAppToken and P101XPAdjustEvetMap (can be provided by your release manager) to the Info.plist:
P101XPAdjustTrackEnabled - enable adjust to track the events (true/false)
P101XPAdjustAppToken - adjust application token
P101XPAdjustEvetMap - event Map
Example:
{"sdk-online": "sucpc8", "sdk_app_hidden": "662lk1", "sdk_call_authorize": "hhnyep",
"sdk_detect_emulator": "arpv2p","sdk_eula_accepted": "mijy8d","sdk_eula_read": "yk3kv9",
"sdk_eula_show": "ijsxnc","sdk_initialized": "3onpe6","sdk_mobvid_close": "felokb",
"sdk_mobvid_open": "i2yt2o","sdk_online": "sucpc8", "sdk_open": "o1w442",
"sdk_profile_close": "tudq7r", "sdk_purchase": "5v34tb", "sdk_qr_login": "79hd19",
"sdk_qr_transit": "9vrjq9","sdk_support_open": "rfuzlx", "sdk_profile_open": "yqh4wd",
"sdk_account_login": "i505ix","sdk_account_logout": "2oe4la"}
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 didRegisterForRemoteNotifications:application deviceToken:deviceToken];
}
Sending events
Use the analyticsTrack method to send events. Any values associated with the event can be passed through NSDictionary.
[P101XP analyticsTrackWithEvent:@"test" values:@{ @"test": @"value" }];
Conversion data
If you need to get conversion data from Adjust, you need to implement the delegate method p101xpOnGetAnalyticsWithConversionData:
- (void)p101xpOnGetAnalyticsWithConversionData:(NSDictionary *)conversionData;
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 analyticsTrackWithEvent:@"af_login" values:@{@"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 Adjust use the next delegate method of P101XPDelegate:
- (void)p101xpOnGetAnalyticsWithConversionData:(NSDictionary *)conversionData;