Preset properties
1. Preset properties for all events
The following preset properties are carried by all events in the JavaScript SDK, including auto-tracked events
| 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 |
| #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 height of the user's device, such as 1080 |
#lib | SDK type | Text | The type of SDK you integrated, such as JavaScript |
| #lib_version | SDK version | Text | The version of the SDK you integrated |
| #os | OS | Text | Such as Android and iOS |
| #browser | Browser type | Text | Type of browser the user uses, such as Chrome and Firefox |
| #browser_version | Browser Version | Text | Version of the browser the user uses, such as Chrome 61.0 and Firefox 57.0 |
| #zone_offset | Time Zone Offset | Numeric | Offset in hours of the data time relative to UTC |
| #system_language | System language | Text | Language set in the user's system |
#ua | User agent | Text | Used to identify the operating system and version, CPU type, browser and version, browser rendering engine, browser language, browser plugins, etc. that the client uses. |
#utm | Campaign source properties | Text | Ad information about where the user came from, including the ad source, ad medium, and more |
2. Preset properties of auto-tracked events
| Property name | Display name | Property type | Description |
|---|---|---|---|
| #url | Page URL | Text | URL of the current page |
| #url_path | Page path | Text | Path of the current page |
| #referrer | Referrer URL | Text | URL of the page before the jump |
| #referrer_host | Referrer domain | Text | Domain of the page before the jump |
| #title | Page Title | Text | Title of the current page |
3. Get preset properties
When server-side tracking needs some preset properties from the app, you can use this method to get the preset properties on the client side and then pass them to the server.
//Get the property object
var presetProperties = ta.getPresetProperties();
//Generate event preset properties
var properties = presetProperties.toEventPresetProperties();
/*
{
"#os":"Mac OS X",
"#screen_width":1920,
"#screen_height":1080,
"#browser":"chrome",
"#browser_version":"91.0.4472.114",
"#device_id":"17a3858fafd9b4-0693d07132e2d1-34657600-2073600-17a3858fafea9b",
"#zone_offset":8
}
*/
//Get a specific preset property
var os = presetProperties.os;//OS type, such as Android
var screenWidth = presetProperties.screenWidth;//Screen width
var screenHeight = presetProperties.screenHeight;//Screen height
var browser = presetProperties.browser;//Browser type
var browserVersion = presetProperties.browserVersion;//Browser version
var deviceId = presetProperties.deviceId;//Device ID
var 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
4. Disable preset property collection
In some scenarios, for compliance or business reasons, you may want to disable the collection of certain preset properties. You can pass the disablePresetProperties field during initialization. Its type is Array, and the preset properties corresponding to the fields you add are not uploaded. For example, to block preset properties such as "#os", "#lib", "#lib_version", "#url", and "#url_path", configure as follows:
var config = {
appId: "APP_ID",
serverUrl: "https://YOUR_SERVER_URL/sync_js",
batch:true,
autoTrack: {
pageShow: true,
pageHide: true,
},
disablePresetProperties:['#os','#lib_version','#lib','#screen_height','#screen_width','#browser','#browser_version',
'#system_language','#ua','#utm','#referrer','#referrer_host','#url','#url_path','#title','#element_type']
};
window.ta = thinkingdata;
ta.init(config);
If you block the device ID and need to use first events, make sure you set the first_check_id property

