Analytics
For analytics, the 101XP SDK uses 101XP Analytics (a ClickHouse-based implementation), AppsFlyer and Firebase Analytics.
Configure
101XP Analytics
Add the id of the analytics project to the <application> section:
com.platform101xp.sdk.analytics.project_id - will be involved in the production environment. Please, ask your release manager for this value.
com.platform101xp.sdk.analytics.project_dev_id - will only be used in the test environment (it should be always 10000). Please, ask your release manager for this value.
The test environment is defined by referrer, i.e., if the application is installed by reference of the form https://play.google.com/store/apps/details?id=com.platform101xp.test&referrer=test
<meta-data android:name="com.platform101xp.sdk.analytics.project_id"
android:value="@string/analytics_project_id" />
<meta-data android:name="com.platform101xp.sdk.analytics.project_dev_id"
android:value="@string/analytics_project_dev_id" />
<receiver android:name="com.platform101xp.sdk.internal.receivers.Platform101XPInstallReferrerReceiver"
android:exported="true">
<intent-filter>
<action android:name="com.android.vending.INSTALL_REFERRER" />
</intent-filter>
</receiver>
Advertising id permission
If your application has politics prohibiting to use of the advertising identifier, please add permission in AndroidManifest.xml with property tools:node="remove"
<uses-permission android:name="com.google.android.gms.permission.AD_ID"
tools:node="remove"/>
Analytics manifest change
For analytics to work, you must add the following rights to the <manifest> section:
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
To send an IMEI of a device, you can also add rights to the <manifest> section:
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
Adjust
Add the adjust_app_token and adjust_event_map (can be provided by your release manager) to the <application> section:
<meta-data
android:name="com.platform101xp.adjust_app_token"
android:value="@string/adjust_app_token" />
<meta-data
android:name="com.platform101xp.adjust_event_map"
android:value="@string/adjust_event_map" />
<meta-data
android:name="com.platform101xp.adjust_sand_box"
android:value="@bool/adjust_sand_box" />
<meta-data
android:name="com.platform101xp.adjust_log_level"
android:value="@string/adjust_log_level" />
adjust_app_token - Adjust Application Token
adjust_event_map - event Map
Example:
"{\"sdk_account_login\":\"qgwa9c\",\"sdk_account_logout\":\"ob82j9\"}"
data in Json format, if event name not found, event do not send.
adjust_sand_box - switch sandbox or production mode
adjust_log_level - To set the verbosity of logging [VERBOSE|DEBUG|INFO|WARN|ERROR|ASSERT|SUPRESS]
Set Any logLevel for add callback event on Log.
If you want to disable all logging, set the log level to SUPRESS
Usage
Sending events
Use the analyticsTrack() method to send events. Any values associated with the event can be passed through Map.
// Java
Map<String, Object> eventValue = new HashMap<String, Object>();
eventValue.put("test", 0);
Platform101XP.Companion.analyticsTrack("test", eventValue);
// Kotlin
val eventValue: MutableMap<String, Any?> = HashMap()
eventValue["TestValue"] = 0
Platform101XP.analyticsTrack("test", eventValue)
To turn off sending events to AppsFlyer, use:
<meta-data android:name="com.platform101xp.appsflyer.track_enabled" android:value="false"/>
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 "player_name":"xxxx", where xxxx - in-game name "server_id" | Used to track users login events (login to the server) |
af_level_achieved | "af_level":"x", where X - Lvl gained by a character "player_id":"xxxxx", where xxxxx - character/in-game account ID "player_name":"xxxx", where xxxx - in-game name "server_id" | Used to track a level achieved |
af_tutorial_completion | "player_id":"xxxxx", where xxxxx - character/in-game account ID "player_name":"xxxx", where xxxx - in-game name "server_id" | Used to track tutorial completions |
Example of sending af_login event from the table:
// Java
final Map<String, Object> properties = new HashMap<String, Object>();
properties.put("player_id", your_player_id);
properties.put("player_name", your_player_name);
properties.put("server_id", your_player_server_id);
Platform101XP.Companion.analyticsTrack("af_login", properties);
// Kotlin
val eventValue: MutableMap<String, Any?> = HashMap()
eventValue["player_id"] = your_player_id
eventValue["player_name"] = your_player_name
eventValue["server_id"] = your_player_server_id
Platform101XP.analyticsTrack("af_login", eventValue)
Please, don't 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 method of Platform101XPListener:
// Java
@Override
public void onGetAnalyticsConversionData(Map map) {
}
// Kotlin
override fun onGetAnalyticsConversionData(dataMap: Map<Any, Any>?) {
}