Preset properties
1. Preset properties
Preset properties collected on different platforms vary to some extent. For details, see the following documents: Android platform, iOS platform
Preset properties on non-native platforms (such as PC, Switch, and other devices):
| Property name | Display name | Property type | Description |
|---|---|---|---|
#ip | IP address | Text | The user's IP address, which AE uses to get the user's geographic location |
| #country | Country | Text | The user's country, generated from the IP address |
| #country_code | Country code | Text | 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 | The user's province, generated from the IP address |
| #city | City | Text | The user's city, generated from the IP address |
| #os_version | OS Version | Text | Such as windows10 |
| #manufacturer | Device manufacturer | Text | Name of the graphics card vendor |
| #os | OS | Text | For example, macOS, Windows |
| #device_id | Device ID | Text | The user's device ID |
| #screen_height | Screen height | Numeric | Screen height of the user's device, such as 1920 |
| #screen_width | Screen width | Numeric | Screen width of the user's device, such as 1080 |
| #device_model | Device model | Text | Model of the user's device, such as iPhone 8 |
| #app_version | App version | Text | The version of your app |
| #bundle_id | Unique app identifier | Text | Bundle name |
#lib | SDK type | Text | The type of SDK you integrated, such as Android and iOS |
| #lib_version | SDK version | Text | The version of the SDK you integrated |
#network_type | Network status | Text | Network status when the event is uploaded, such as Mobile and LAN |
| #carrier | Network carrier | Text | Network carrier of the user's device, such as China Mobile and China Telecom |
#zone_offset | Time Zone Offset | Numeric | Offset in hours of the data time relative to UTC |
#system_language | System language | Text | System language of the user's device (ISO 639-1, that is, two lowercase letters), such as zh and en |
| #start_reason | Launch reason | Text | Reason the app was opened or brought to the foreground |
2. Get preset properties
In v2.2.0 and later, you can call the TDAnalytics.GetPresetProperties() method 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.
//Get the property object
TDPresetProperties presetProperties = TDAnalytics.GetPresetProperties();
//Generate event preset properties
Dictionary<string, object> eventPresetProperties = presetProperties.ToDictionary();
/*
{
"#carrier": "中国电信",
"#os": "iOS",
"#device_id": "A8B1C00B-A6AC-4856-8538-0FBC642C1BAD",
"#screen_height": 2264,
"#bundle_id": "com.sw.thinkingdatademo",
"#app_version": "0.1",
"#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
string bundleId = presetProperties.BundleId;//Package name
string appVersion = presetProperties.AppVersion;//App version
string os = presetProperties.OS;//OS type, such as Android and iOS
string systemLanguage = presetProperties.SystemLanguage;//System language of the phone
int screenWidth = presetProperties.ScreenWidth;//Screen width
int screenHeight = presetProperties.ScreenHeight;//Screen height
string deviceModel = presetProperties.DeviceModel;//Device model
string deviceId = 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.Manufacturer;//Phone manufacturer, such as HuaWei and Apple
string networkType = presetProperties.NetworkType;//Network type
string osVersion = presetProperties.OSVersion;//OS version
double zoneOffset = presetProperties.ZoneOffset;//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
3. Disable preset property collection
In v2.3.1 and later, you can block specific preset properties from being reported. To configure the switches, add ta_public_config.xml to the Resources directory. The preset properties that correspond to the configured fields are not uploaded. For example:
<?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>#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> -->
</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

