menu
Is this helpful?

# Preset Properties

# 1. Preset Properties of All Events

All Events in Andriod 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 APP start event (ta_app_start)
Property name Display name Property type Instruction
#resume_from_background
Resume from the background or
not

Bool

Indicating whether the APP is
enabled
by the user or resumed from the background. If the value is true, it means the APP is resumed from the background; if the value is false, it means the APP is
enabled
by the user directly.
#start_reason
APP enable source
Text
The content is
JSON
character string; when the APP is enabled by url or intent method, the
url
content and the

data
in intent would be recorded automatically. For the sample, please refer to:
{url:"thinkingdata://","data":{}}
#background_duration
Background duration
Numeric value
Record the background duration of the APP in the time interval between two start events (Unit: second)
  • Preset properties of APP end event (ta_app_end)
Property name Display name Property type Instruction
#duration
Event duration
Numeric value
Indicating the duration of the APP access (Unit: second).
  • Preset properties of APP view screen event (ta_app_view)
Property name Display name Property type Instruction
#title
Screen title
Text
The title of the Activity to which the element belongs, whose value is the value of the title property
#screen_name
Screen name
Text
The
package.class
name of the Activity to which the element belongs
#url
Screen URL
Text
The url of current screen, to be set by invoking
getScreenUrl

#referrer
Forward address
Text
The address of the screen before skipping, to be set by invoking
getScreenUrl
  • Preset properties of APP element click event
Property name Display name Property type Instruction
#title
Screen title
Text
The title of the Activity to which the element belongs, whose value is the value of the title property
#screen_name
Screen name
Text
The package.class name of the Activity to which the element belongs
#element_id
Element ID
Text
The ID of element, in which andriod:id is used by default, and could be set by invoking setViewID
#element_type
Element type
Text
Type of the element
#element_selector
Element selector
Text
Splicing of the viewPath of the element
#element_position
Element position
Text
Position information of element, which would only be uploaded when the element has position property
#element_content
Element content
Text
Content on the element
  • Preset properties of APP crash event (ta_app_crash)

# 3. Other Preset Properties

In addition to the Preset properties above, some preset properties would only be recorded after corresponding API is called:

Property name Display name Property type Instruction
#duration
Event duration
Numeric value
Timing function
timeEvent
should be invoked to record the event duration (Unit: second)
#background_duration
Background duration
numeric value
Timing function
timeEvent
should be called to record the background duration within an event interval (Unit: second)

# 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
   TDPresetProperties presetProperties = TDAnalytics.getPresetProperties();

   //Preset properties of Event
   JSONObject properties = presetProperties.toEventPresetProperties();
   /*
   {
        "#carrier": "T-Mobile",
        "#os": "Android",
        "#device_id": "dd4a508df0dbff08",
        "#screen_height": 2560,
        "#bundle_id": "cn.thinkingdata.android.demo",
        "#device_model": "sdk_gphone64_arm64",
        "#screen_width": 1440,
        "#system_language": "en",
        "#install_time": "2022-08-19 17:31:52.398",
        "#simulator": true,
        "#manufacturer": "Google",
        "#os_version": "12",
        "#app_version": "1.0",
        "#network_type": "3G",
        "#zone_offset": 8,
        "#ram": "0.8\/1.9",
        "#disk": "0.1\/0.8",
        "#fps": 60
    }
   */

    //get a certain preset properties
    String bundle_id = presetProperties.bundle_id;//package name
    String os =  presetProperties.os;//os type, e.g., Android
    String system_language = presetProperties.system_language;//type of mobile phone system language
    int screen_width = presetProperties.screen_width;//screen width
    int screen_height = presetProperties.screen_height;//screen height
    String device_model = presetProperties.device_model;//device model
    String device_id = presetProperties.device_id;//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.manufacture;//mobile phone manufacturer, e.g., HuaWei
    String network_type = presetProperties.network_type;//network type
    String os_version = presetProperties.os_version;//system version number
    String app_version = presetProperties.app_version;//app version number
    double zone_offset = presetProperties.zone_offset;//timezone offset value
    String ram = presetProperties.ram;//storage usage
    String disk = presetProperties.disk;//disk usage
    int fps = presetProperties.fps;//fps
    String installTime = presetProperties.installTime;//app installation time
    boolean isSimulator = presetProperties.isSimulator;//the device is a simulator or not
    

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

# 5. Disable Preset Property Tracking

Under certain scenarios, you may want to forbid tracking certain preset properties to ensure compliance and meet actual business requirements. In this case, you can add ta_public_config.xml under the res/values catalog of the engineering catalog, which would be used to configure the property array that is not allowed to be tracked.

<?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>#zone_offset</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>-->
<!--        <item>#background_duration</item>-->
<!--        <item>#duration</item>-->
    </string-array>
    <!-- ThinkingAnalytics DisablePresetProperties end -->
</resources>

As for Android ID property, we support complete isolation at the code level, that is, relevant codes used to get the property shall no longer be contained in the APP after isolation. For detailed information, please refer to theChapter of auto-tracking plugin configuration