目录
此内容是否有帮助?

# Preset Properties

Preset Properties will have differences on different platforms, for details: Android, iOS.

# 1. Preset Properties of All Events

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

# 2. Preset Properties of Auto-tracking Event

The following preset properties are the properties set specially for each auto-tracking event

  • Preset properties of Mini Game end event (tg_mg_hide)
Property name Display name Property type Instruction
#duration
Event duration
Numeric value
Indicates the duration from starting(ta_mg_show) to hiding (ta_mg_hide) this time, in seconds

# 3. Getting Preset Properties

If you need to use the preset properties of the client SDK when tracking events on the server, then you can use getPresetProperties to get these properties and upload them to the server.

   //get preset properties object
   var presetProperties = ta.getPresetProperties();

   //get all preset properties
   var properties = presetProperties.toEventPresetProperties();
   /*
      {
         "#device_model":"iPhone 5",
         "#device_id":"3204487163-1624513721217",
         "#screen_width":320,
         "#screen_height":568,
         "#os":"iOS",
         "#os_version":"10.0.1",
         "#network_type":"wifi",
         "#zone_offset":8,
         "#manufacturer":"Apple"
       }
   */

    //get a preset property
    var os =  presetProperties.os;//os name, e.g. Android
    var osVersion = presetProperties.osVersion;//os version
    var networkType = presetProperties.networkType;//network type
    var manufacture = presetProperties.manufacture;//device manufacture name
    var deviceModel= presetProperties.deviceModel;//device mode
    var screenWidth = presetProperties.screenWidth;//screen width
    var screenHeight = presetProperties.screenHeight;//screen height
    var deviceId = presetProperties.deviceId;//device ID
    var zoneOffset = presetProperties.zoneOffset;//time zone offset
    

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