enableAutoTrack static method

void enableAutoTrack(
  1. int autoTrackEventType, {
  2. Map<String, dynamic>? autoTrackEventProperties,
  3. TDAutoTrackConfig? autoTrackPageConfig,
  4. String? appId,
})

Enable the auto tracking function with properties

autoTrackEventType Indicates the type of the automatic collection event to be enabled

autoTrackEventProperties auto track event properties

appId It is used in multi-instance scenarios. If there is only one instance, it is recommended not to pass

Implementation

static void enableAutoTrack(int autoTrackEventType,
    {Map<String, dynamic>? autoTrackEventProperties,
    TDAutoTrackConfig? autoTrackPageConfig,
    String? appId}) {
  ThinkingAnalyticsAPI? instance = _getInstanceByAppId(appId);
  instance?.enableAutoTrackWithProperties(
      autoTrackEventType, autoTrackEventProperties);
  if ((autoTrackEventType & TDAutoTrackEventType.APP_CLICK) > 0) {
    TDAutoTrackManager.instance.enableElementClick(true);
  }
  if ((autoTrackEventType & TDAutoTrackEventType.APP_VIEW_SCREEN) > 0) {
    TDAutoTrackManager.instance.enablePageView(true);
    if (autoTrackPageConfig != null) {
      TDAutoTrackManager.instance.config = autoTrackPageConfig;
    }
  }
}