menu
Is this helpful?

# Automatically Track Events

# 1. Enable Auto-Tracking

You can call enableAutoTrack and pass in a List of type TDAutoTrackEventType to enable the auto-tracking function:

  1. Install: behavior of APP installation,the corresponding type is TDAutoTrackEventType.APP_INSTALL
  2. Open APP: including activiting APP and resuming APP from the background, the corresponding type is TDAutoTrackEventType.APP_START
  3. Close APP: including disabling the APP and calling in the background, the corresponding type is TDAutoTrackEventType.APP_END
  4. Crash:Record crash information when the APP crashes, the corresponding type is TDAutoTrackEventType.APP_CRASH

pay attention to auto-tracking event:

  1. The auto-tracking event is implemented in the native SDK, so Dynamic Public Properties cannot be added to the automatic collection event at present.
  2. If you need to set the distinct ID or public properties, please complete the settings before enabling automatic event collection.

Example of enabling auto-tracking:

TDAnalytics.enableAutoTrack(TDAutoTrackEventType.APP_START |
    TDAutoTrackEventType.APP_END |
    TDAutoTrackEventType.APP_INSTALL |
    TDAutoTrackEventType.APP_CRASH);

# 2. Set Auto-tracking Event Public Properties

You can call setAutoTrackProperties to set or update custom properties

TDAnalytics.enableAutoTrack(TDAutoTrackEventType.APP_START,
    autoTrackEventProperties: {
  'auto_test': 'stu',
  'auto_arr': [1, 2, 3],
  'auto_obj': {'obj_test': 'xxx'}
});