Preset properties
1. Preset properties carried by all events
The following preset properties are carried by all events in the Android SDK, including auto-tracked events
| Property name | Display name | Property type | When collected | Description |
|---|---|---|---|---|
#ip | IP address | Text | Collected on the server | The user's IP address, which AE uses to get the user's geographic location |
| #country | Country | Text | Collected on the server | The user's country, generated from the IP address |
#country_code | Country code | Text | Collected on the server | The country code of the user's country (ISO 3166-1 alpha-2, that is, two uppercase letters), generated from the IP address |
| #province | Province | Text | Collected on the server | The user's province, generated from the IP address |
| #city | City | Text | Collected on the server | The user's city, generated from the IP address |
| #os_version | OS Version | Text | Collected once at initialization | iOS 11.2.2, Android 8.0.0, etc. |
#manufacturer | Device manufacturer | Text | Collected once at initialization | Manufacturer of the user's device, such as Apple and vivo |
| #os | OS | Text | Collected once at initialization | Such as Android and iOS |
| #device_id | Device ID | Text | Collected once at initialization | User's device ID: IDFV or UUID on iOS, androidID on Android |
| #screen_height | Screen height | Numeric | Collected once at initialization | Screen height of the user's device, such as 1920 |
| #screen_width | Screen width | Numeric | Collected once at initialization | Screen width of the user's device, such as 1080 |
| #device_model | Device model | Text | Collected once at initialization | Model of the user's device, such as iPhone 8 |
| #device_type | Device Type | Text | Collected once at initialization | Device type, such as "Tablet" and "Phone" |
| #app_version | App version | Text | Collected once at initialization | The version of your app |
| #bundle_id | Unique app identifier | Text | Collected once at initialization | App package name or process name |
#lib | SDK type | Text | Collected once at initialization | The type of SDK you integrated, such as Android and iOS |
| #lib_version | SDK version | Text | Collected once at initialization | The version of the SDK you integrated |
| #network_type | Network status | Text | Collected once at initialization and again when the network status changes | Network status when the event is uploaded, such as WIFI, 3G, and 4G |
#carrier | Network carrier | Text | Collected once at initialization | Network carrier of the user's device, such as China Mobile and China Telecom |
#zone_offset | Time Zone Offset | Numeric | Collected when the event occurs | Offset in hours of the data time relative to UTC |
| #install_time | App install time | Time | Collected once at initialization | Time when the user installed the app; the value comes from the system |
| #simulator | Whether it is a simulator | Boolean | Collected once at initialization | Whether the device is a simulator: true/false |
#ram | Device memory status | Text | Collected when the event occurs | Current available memory and total memory of the user's device in GB, such as 1.4/2.4 (not collected by default in v3.2.0 and later) |
#disk | Device storage status | Text | Collected when the event occurs | Current available storage and total storage of the user's device, in GB, such as 30/200 (not collected by default in v3.2.0 and later) |
#fps | Device frame rate | Numeric | Collected when the event occurs | Current frame rate (frames per second) of the user's device, such as 60 (not collected by default in v3.2.0 and later) |
#system_language | System language | Text | Collected once at initialization | System language of the user's device (ISO 639-1, that is, two lowercase letters), such as zh and en |
2. Preset properties of auto-tracked events
The following preset properties are specific to each auto-tracked event
- Preset properties of the APP start event (ta_app_start)
| Property name | Display name | Property type | Description |
|---|---|---|---|
#resume_from_background | Resumed from background | Boolean | Indicates whether the APP was opened or woken from the background. true means it was woken from the background, and false means it was opened directly |
| #start_reason | Launch reason | Text | The content is a JSON string. When the APP is opened through a URL or an intent, the URL content and the data in the intent are recorded automatically. Example: {url:"thinkingdata://","data":{}} |
#background_duration | Background duration | Number | The time the app spent in the background between two start events, in seconds |
- Preset properties of the APP end event (ta_app_end)
| Property name | Display name | Property type | Description |
|---|---|---|---|
| #duration | Event duration | Number | The duration of this APP visit (from start to end), in seconds |
- Preset properties of the APP view page event (ta_app_view)
| Property name | Display name | Property type | Description |
|---|---|---|---|
| #title | Page Title | Text | Title of the Activity that the view belongs to, taken from the title attribute |
| #screen_name | Page name | Text | Package name.class name of the Activity that the view belongs to |
| #url | Page URL | Text | URL of the current page. Call getScreenUrl to set the URL |
| #referrer | Referrer URL | Text | URL of the page before the jump. The previous page must call getScreenUrl to set the URL |
- Preset properties of the APP control click event (ta_app_click)
| Property name | Display name | Property type | Description |
|---|---|---|---|
| #title | Page Title | Text | Title of the Activity that the view belongs to, taken from the Activity's title attribute |
| #screen_name | Page name | Text | Package name.class name of the Activity that the view belongs to |
| #element_id | Element ID | Text | ID of the view. android:id is used by default; you can call setViewID to set it |
| #element_type | Element type | Text | The type of the control |
| #element_selector | Element selector | Text | Concatenated viewPath of the view |
| #element_position | Element position | Text | Position of the view; uploaded only when the view has a position attribute |
| #element_content | Element content | Text | The content on the control |
- Preset properties of the APP crash event (ta_app_crash)
| Property name | Display name | Property type | Description |
|---|---|---|---|
| #app_crashed_reason | Exception information | Text | String. Records the stack trace at the time of the crash |
3. Other preset properties
In addition to the preset properties above, some preset properties are recorded only after you call the corresponding APIs:
| Property name | Display name | Property type | Description |
|---|---|---|---|
#duration | Event duration | Number | Requires calling the timing function timeEvent. Records how long the event lasts, in seconds |
#background_duration | Background duration | Numeric | Requires calling the timing function timeEvent. Records how long the app stays in the background during the event, in seconds |
4. Get preset properties
In v2.7.0 and later, you can call getPresetProperties() to get preset properties.
When server-side tracking needs some preset properties from the app, you can use this method to get them on the app side and then pass them to the server.
- Java
- Kotlin
//Get the property object
TDPresetProperties presetProperties = TDAnalytics.getPresetProperties();
//Generate event preset properties
JSONObject properties = presetProperties.toEventPresetProperties();
/*
{
"#carrier": "T-Mobile",
"#os": "Android",
"#device_id": "dd4a508df0dbff08",
"#screen_height": 2560,
"#bundle_id": "cn.thinkingdata.android.demo",
"#device_model": "sdk_gphone64_arm64",
"#screen_width": 1440,
"#system_language": "en",
"#install_time": "2022-08-19 17:31:52.398",
"#simulator": true,
"#manufacturer": "Google",
"#os_version": "12",
"#app_version": "1.0",
"#network_type": "3G",
"#zone_offset": 8,
"#ram": "0.8\/1.9",
"#disk": "0.1\/0.8",
"#fps": 60
}
*/
//Get a specific preset property
String bundle_id = presetProperties.bundleId;//Package name
String os = presetProperties.os;//OS type, such as Android
String system_language = presetProperties.systemLanguage;//Phone system language
int screen_width = presetProperties.screenWidth;//Screen width
int screen_height = presetProperties.screenHeight;//Screen height
String device_model = presetProperties.deviceModel;//Device model
String device_id = presetProperties.deviceId;//Unique device identifier
String carrier = presetProperties.carrier;//Carrier of the phone's SIM card; on dual-SIM phones, the carrier of the primary SIM card is used
String manufacture = presetProperties.manufacture;//Phone manufacturer, such as HuaWei
String network_type = presetProperties.networkType;//Network type
String os_version = presetProperties.osVersion;//OS version
String app_version = presetProperties.appVersion;//App version
double zone_offset = presetProperties.zoneOffset;//Time zone offset
String ram = presetProperties.ram;//Memory usage
String disk = presetProperties.disk;//Disk usage
int fps = presetProperties.fps;//fps
String installTime = presetProperties.installTime;//App install time
boolean isSimulator = presetProperties.isSimulator;//Whether the device is a simulator
//Get the property object
val presetProperties = TDAnalytics.getPresetProperties()
//Generate event preset properties
val properties = presetProperties.toEventPresetProperties()
/*
{
"#carrier": "T-Mobile",
"#os": "Android",
"#device_id": "dd4a508df0dbff08",
"#screen_height": 2560,
"#bundle_id": "cn.thinkingdata.android.demo",
"#device_model": "sdk_gphone64_arm64",
"#screen_width": 1440,
"#system_language": "en",
"#install_time": "2022-08-19 17:31:52.398",
"#simulator": true,
"#manufacturer": "Google",
"#os_version": "12",
"#app_version": "1.0",
"#network_type": "3G",
"#zone_offset": 8,
"#ram": "0.8\/1.9",
"#disk": "0.1\/0.8",
"#fps": 60
}
*/
//Get a specific preset property
val bundle_id: String = presetProperties.bundleId //Package name
val os = presetProperties.os //OS type, such as Android
val system_language: String = presetProperties.systemLanguage //Phone system language
val screen_width: Int = presetProperties.screenWidth //Screen width
val screen_height: Int = presetProperties.screenHeight //Screen height
val device_model: String = presetProperties.deviceModel //Device model
val device_id: String = presetProperties.deviceId //Unique device identifier
val carrier = presetProperties.carrier //Carrier of the phone's SIM card; on dual-SIM phones, the carrier of the primary SIM card is used
val manufacture = presetProperties.manufacture //Phone manufacturer, such as HuaWei
val network_type: String = presetProperties.networkType //Network type
val os_version: String = presetProperties.osVersion //OS version
val app_version: String = presetProperties.appVersion //App version
val zone_offset: Double = presetProperties.zoneOffset //Time zone offset
val ram = presetProperties.ram //Memory usage
val disk = presetProperties.disk //Disk usage
val fps = presetProperties.fps //fps
val installTime = presetProperties.installTime //App install time
val isSimulator = presetProperties.isSimulator //Whether the device is a simulator
IP address, country, and city information is parsed and generated on the server side. The client doesn't provide APIs to get these properties
5. Disable preset property collection
In some scenarios, for compliance or business reasons, you may want to prevent certain preset properties from being collected. You can add a ta_public_config.xml file to the res/values directory of your project to configure an array of the properties whose collection you want to disable.
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- ThinkingAnalytics DisablePresetProperties start -->
<string-array name="TDDisPresetProperties">
<!-- <item>#disk</item>-->
<!-- <item>#fps</item>-->
<!-- <item>#ram</item>-->
<!-- <item>#app_version</item>-->
<!-- <item>#os_version</item>-->
<!-- <item>#manufacturer</item>-->
<!-- <item>#device_model</item>-->
<!-- <item>#screen_height</item>-->
<!-- <item>#screen_width</item>-->
<!-- <item>#carrier</item>-->
<!-- <item>#device_id</item>-->
<!-- <item>#system_language</item>-->
<!-- <item>#lib</item>-->
<!-- <item>#lib_version</item>-->
<!-- <item>#os</item>-->
<!-- <item>#bundle_id</item>-->
<!-- <item>#install_time</item>-->
<!-- <item>#start_reason</item>-->
<!-- <item>#simulator</item>-->
<!-- <item>#network_type</item>-->
<!-- <item>#zone_offset</item>-->
<!-- <item>#start_reason</item>-->
<!-- <item>#resume_from_background</item>-->
<!-- <item>#title</item>-->
<!-- <item>#screen_name</item>-->
<!-- <item>#url</item>-->
<!-- <item>#referrer</item>-->
<!-- <item>#element_type</item>-->
<!-- <item>#element_id</item>-->
<!-- <item>#element_position</item>-->
<!-- <item>#element_content</item>-->
<!-- <item>#element_selector</item>-->
<!-- <item>#app_crashed_reason</item>-->
<!-- <item>#background_duration</item>-->
<!-- <item>#duration</item>-->
</string-array>
<!-- ThinkingAnalytics DisablePresetProperties end -->
</resources>
If you block the device ID and need to use first events, make sure you set the first_check_id property
For the Android ID property, we support complete isolation at the code level: after isolation, the app no longer contains any code that gets this property. For details, see Auto-tracking plugin configuration

