Preset properties
1. Preset properties carried by all events
The following preset properties are carried by all events in the iOS 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 | The OS version number, such as 15.6.1 |
| #manufacturer | Device manufacturer | Text | Collected once at initialization | Manufacturer of the user's device, such as Apple |
| #os | OS | Text | Collected once at initialization | Such as iOS |
#device_id | Device ID | Text | Collected once at initialization | The user's device ID. On iOS, the user's IDFV or UUID is used |
| #device_type | Device Type | Text | Collected once at initialization | Device type, such as iPhone and iPad |
| #screen_height | Screen height | Numeric | Collected once at initialization | Screen height of the user's device, such as 667 |
| #screen_width | Screen width | Numeric | Collected once at initialization | Screen width of the user's device, such as 375 |
| #device_model | Device model | Text | Collected once at initialization | Model of the user's device, such as iPhone12,8 |
| #app_version | App version | Text | Collected once at initialization | The version of your app |
| #bundle_id | Unique app identifier | Text | Collected once at initialization | Bundle name |
#lib | SDK type | Text | Collected when the event occurs | The type of SDK you integrated, such as Android and iOS |
| #lib_version | SDK version | Text | Collected when the event occurs | 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. This field is not collected on iOS 16.4 and later |
#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 |
#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 |
#fps | Device FPS | 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 SDK v3.2.0 and later) |
#system_language | System language | Text | Collected when the event occurs | System language of the user's device (ISO 639-1, that is, two lowercase letters), such as zh and en |
| #relaunched_in_background | Whether the app is in the background | Boolean | Collected when the event occurs | When the APP is launched in the background, this property is YES in the collected events. When the APP is launched normally, the collected events don't contain this property. |
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 reason the APP was launched, as a JSON string. Currently, deeplink, push, and 3D Touch launch reasons can be collected. Sample data: {url:"thinkingdata://","data":{}} |
#background_duration | Background duration | Number | How long the app stays 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 | Numeric | 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 | The title of the View Controller, whose value is the value of the controller.navigationItem.title property |
| #screen_name | Page name | Text | The class name of the View Controller |
#url | Page URL | Text | The URL of the current page. Call getScreenUrl to set the URL |
#referrer | Referrer URL | Text | The URL of the page before the jump. That 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 | The title of the View Controller, whose value is the value of the controller.navigationItem.title property |
| #screen_name | Page name | Text | The class name of the View Controller |
#element_id | Element ID | Text | The ID of the control, which must be set with thinkingAnalyticsViewID |
| #element_type | Element type | Text | The type of the control |
| #element_selector | Element selector | Text | The concatenation of the control's viewPath |
#element_position | Element position | Position of the control. Exists only when the control type is UITableView or UICollectionView, and indicates the position where the control was clicked. The value is section number(Section):row number(Row) | |
| #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 | Numeric | 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.
- Objective-C
- Swift
//Get the property object
TDPresetProperties *presetProperties = [TDAnalytics getPresetProperties];
//Generate event preset properties
NSDictionary *properties = [presetProperties toEventPresetProperties];
/*
{
"#carrier": "中国电信",
"#os": "iOS",
"#device_id": "A8B1C00B-A6AC-4856-8538-0FBC642C1BAD",
"#screen_height": 2264,
"#bundle_id": "com.sw.thinkingdatademo",
"#manufacturer": "Apple",
"#device_model": "iPhone7",
"#screen_width": 1080,
"#system_language": "zh",
"#os_version": "10",
"#network_type": "WIFI",
"#zone_offset": 8,
}
*/
//Get a specific preset property
NSString *bundle_id = presetProperties.bundle_id;//Package name
NSString *os = presetProperties.os;//OS type, such as iOS
NSString *system_language = presetProperties.system_language;//Phone system language
NSNumber *screen_width = presetProperties.screen_width;//Screen width
NSNumber *screen_height = presetProperties.screen_height;//Screen height
NSString *device_model = presetProperties.device_model;//Device model
NSString *device_id = presetProperties.device_id;//Unique device identifier
NSString *carrier = presetProperties.carrier;//Carrier of the phone's SIM card; on dual-SIM phones, the carrier of the primary SIM card is used
NSString *manufacture = presetProperties.manufacturer;//Phone manufacturer, such as Apple
NSString *network_type = presetProperties.network_type;//Network type
NSString *os_version = presetProperties.os_version;//OS version
NSNumber *zone_offset = presetProperties.zone_offset;//Time zone offset
let presetProperties = TDAnalytics.getPresetProperties();
//Generate event preset properties
let properties = presetProperties.toEventPresetProperties();
//Get a specific preset property
let bundle_id = presetProperties.bundle_id;//Package name
let os = presetProperties.os;//OS type, such as iOS
let system_language = presetProperties.system_language;//Phone system language
let screen_width = presetProperties.screen_width;//Screen width
let screen_height = presetProperties.screen_height;//Screen height
let device_model = presetProperties.device_model;//Device model
let device_id = presetProperties.device_id;//Unique device identifier
let carrier = presetProperties.carrier;//Carrier of the phone's SIM card; on dual-SIM phones, the carrier of the primary SIM card is used
let manufacture = presetProperties.manufacturer;//Phone manufacturer, such as Apple
let network_type = presetProperties.network_type;//Network type
let os_version = presetProperties.os_version;//OS version
let zone_offset = presetProperties.zone_offset;//Time zone offset
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 stop collecting certain preset properties. You can add the TDDisPresetProperties field of type Array to the info.plist file of your project. The preset properties that correspond to the added fields are not uploaded. For example, to block preset properties such as @"#fps", @"#ram", @"#disk", @"#start_reason", and @"#simulator", configure them as shown in the following figure:
If you block the device ID and need to use first events, make sure you set the first_check_id property

