menu
Is this helpful?

# Preset Properties

# 1. Preset Properties of All Events

All Events in Cocos2d-x SDK(including auto-tracking events) would have the following preset property.

The prefabricated attributes collected by each platform will have certain differences. For details, please refer to the following documents: Android platformiOS platform

Preset properties for Mac and Windows:

Property name Display name Property type Instruction
#ip IP address Text IP address of the user, based on which TE would get the geographical location of the user
#country Country Text The country where the user is located; generated based on the IP address
#country_code Country code Text The code of the country where the user is located (ISO 3166-1 alpha-2, two English characters in upper case); generated based on the IP address
#province Province Text The province or state where the user is located; generated based on the IP address
#city City Text The city where the user is located; generated based on the IP address
#os OS version Text iOS 11.2.2, Android 8.0.0, e.g.
#device_id Device manufacturer Text The manufacturer of the user device, namely, Apple, Sumsung, etc.
#screen_height OS Text E.g., Android, iOS, etc.
#screen_width Screen width Numeric value The screen width of a device, e.g., 1080, etc.
#lib SDK type Text The type of the SDK which you integrate, e.g., Android,iOS, etc.
#lib_version SDK version Text The version of the SDK which you integrate
#zone_offset Timezone offset Numeric value Data’s offset hours when compared with UTC time

# Getting Preset Properties

When some preset properties of the APP is required for the server data tracking, this method can be invoked to get the preset properties of the App side and then send them to the server.

   //get property objects
   PresetProperties* presetProperties =  TDAnalytics::getPresetProperties();

   //Preset properties of Event
   TDJSONObject* properties = presetProperties->toEventPresetProperties();
   /*
   {
        "#carrier": "T-Mobile",
        "#os": "Android",
        "#device_id": "abb8e87bfb5ce66c",
        "#screen_height": 2264,
        "#bundle_id": "com.sw.thinkingdatademo",
        "#manufacturer": "realme",
        "#device_model": "RMX1991",
        "#screen_width": 1080,
        "#system_language": "zh",
        "#os_version": "10",
        "#network_type": "WIFI",
        "#zone_offset": 8,
        "#app_version":"1.0"
    }
   */

    //get a certain preset properties
    string bundleId = presetProperties->bundleId;//package name
    string os =  presetProperties->os; //os type, e.g., Android
    string systemLanguage = presetProperties->systemLanguage; //type of mobile phone system language
    int screenWidth = presetProperties->screenWidth; //screen width
    int screenHeight = presetProperties->screenHeight; //screen height
    string deviceModel = presetProperties->deviceModel; //device model
    string deviceId = presetProperties->deviceId;//unique identifier of device
    string carrier = presetProperties->carrier; //information about operator of the SIM card. Operation information of the primary card should be get under dual-card dual-standby mode
    string manufacture = presetProperties->manufacturer; //mobile phone manufacturer, e.g., HuaWei
    string networkType = presetProperties->networkType; //network type
    string osVersion = presetProperties->osVersion; //system version number
    string appVersion = presetProperties->appVersion; //app version number
    double zoneOffset = presetProperties->zoneOffset; //timezone offset value

IP, nation and city information are parsed and generated by the server. The client shall not provide the api to get such properties