Package 

Class TDAnalytics


  • 
    public class TDAnalytics
    
                        

    The packaging class of ThinkingAnalyticsSDK provides static methods, which is more convenient for customers to use

    • Method Detail

      • calibrateTime

         static void calibrateTime(long timestamp)

        time calibration with timestamp

        Parameters:
        timestamp - timestamp
      • enableLog

         static void enableLog(boolean enableLog)

        enable debug logging

        Parameters:
        enableLog - log switch
      • setCustomerLibInfo

         static void setCustomerLibInfo(String libName, String libVersion)

        Set libName and libVersion of SDK

        Parameters:
        libName - sdk name
        libVersion - sdk version
      • init

         static void init(Context context, String appId, String serverUrl)

        Initialize the SDK. The track function is not available until this interface is invoked.

        Parameters:
        context - context
        appId - app id
        serverUrl - server url
      • init

         static synchronized void init(TDConfig config)

        Initialize the SDK with config. The track function is not available until this interface is invoked.

        Parameters:
        config - init config
      • lightInstance

         static String lightInstance()

        Create lightweight SDK instances. Lightweight SDK instances do not supportcaching of local account ids, guest ids, public properties, etc.

      • setNetworkType

         static void setNetworkType(TDAnalytics.TDNetworkType networkType)

        Set the network conditions for uploading. By default, the SDK will upload data on 3G, 4G and Wifi.

        Parameters:
        networkType - Type of the network on which data is uploaded
      • track

         static void track(String eventName)

        Upload a single event, containing only preset properties and set public properties.

        Parameters:
        eventName - event name
      • track

         static void track(String eventName, JSONObject properties)

        Upload events and their associated attributes.

        Parameters:
        eventName - event name
        properties - event properties
      • track

         static void track(String eventName, JSONObject properties, Date time, TimeZone timeZone)

        Upload the event and set the event trigger time. SDK v2.2.0 support is available.

        Parameters:
        eventName - event name
        properties - event properties
        time - event time
        timeZone - event timeZone
      • track

         static void track(TDEventModel eventModel)

        Upload a special type of event.

        Parameters:
        eventModel - Event Object TDFirstEventModel / TDOverWritableEventModel / TDUpdatableEventModel
      • enableAutoTrack

         static void enableAutoTrack(int autoTrackEventType)

        Enable the auto tracking function.

        Parameters:
        autoTrackEventType - Indicates the type of the automatic collection event to be enabled
      • enableAutoTrack

         static void enableAutoTrack(int autoTrackEventType, JSONObject properties)

        Enable the auto tracking function with properties

        Parameters:
        autoTrackEventType - Indicates the type of the automatic collection event to be enabled
        properties - properties
      • enableAutoTrack

         static void enableAutoTrack(int autoTrackEventType, TDAnalytics.TDAutoTrackEventHandler eventHandler)

        Enable the auto tracking function with properties

        Parameters:
        autoTrackEventType - Indicates the type of the automatic collection event to be enabled
        eventHandler - callback
      • timeEvent

         static void timeEvent(String eventName)

        Record the event duration, call this method to start the timing, stop the timing when the target event is uploaded, and add the attribute #duration to the event properties, in seconds.

        Parameters:
        eventName - target event name
      • userSet

         static void userSet(JSONObject properties)

        Sets the user property, replacing the original value with the new value if the property already exists.

        Parameters:
        properties - user property
      • userSetOnce

         static void userSetOnce(JSONObject properties)

        Sets a single user attribute, ignoring the new attribute value if the attribute already exists.

        Parameters:
        properties - user property
      • userUnset

         static void userUnset(Array<String> properties)

        Reset user properties.

        Parameters:
        properties - user property
      • userAdd

         static void userAdd(JSONObject properties)

        Only one attribute is set when the user attributes of a numeric type are added.

        Parameters:
        properties - user property
      • userAppend

         static void userAppend(JSONObject properties)

        Append a user attribute of the List type.

        Parameters:
        properties - user property
      • userUniqAppend

         static void userUniqAppend(JSONObject properties)

        The element appended to the library needs to be done to remove the processing, remove the support, and then import.

        Parameters:
        properties - user property
      • userDelete

         static void userDelete()

        Delete the user attributes, but retain the uploaded event data. This operation is not reversible and should be performed with caution.

      • setSuperProperties

         static void setSuperProperties(JSONObject superProperties)

        Set the public event attribute, which will be included in every event uploaded after that. The public event properties are saved without setting them each time.

        Parameters:
        superProperties - super properties
      • unsetSuperProperty

         static void unsetSuperProperty(String superPropertyName)

        Clears a public event attribute.

        Parameters:
        superPropertyName - Public event attribute key to clear
      • login

         static void login(String loginId)

        Set the account ID. Each setting overrides the previous value. Login events will not be uploaded.

        Parameters:
        loginId - account id
      • logout

         static void logout()

        Clearing the account ID will not upload user logout events.

      • setDistinctId

         static void setDistinctId(String identity)

        Set the distinct ID to replace the default UUID distinct ID.

        Parameters:
        identity - distinct id
      • getDistinctId

         static String getDistinctId()

        Get a visitor ID: The #distinct_id value in the reported data.

      • flush

         static void flush()

        Empty the cache queue. When this function is called, the data in the current cache queue will attempt to be reported.If the report succeeds, local cache data will be deleted.

      • enableThirdPartySharing

         static void enableThirdPartySharing(int types)

        Enable three-party data synchronization.

        Parameters:
        types - third types
      • enableThirdPartySharing

         static void enableThirdPartySharing(int type, Object obj)

        Enable three-party data synchronization.

        Parameters:
        type - third types
        obj - extras
      • trackViewScreen

         static void trackViewScreen(Activity activity)

        Manually trigger the page browsing event upload.

        Parameters:
        activity - activity
      • trackViewScreen

         static void trackViewScreen(Fragment fragment)

        Manually trigger the page browsing event upload.

        Parameters:
        fragment - Indicates the Fragment instance to be collected
      • trackViewScreen

         static void trackViewScreen(Object fragment)

        Manually trigger the page browsing event upload.

        Parameters:
        fragment - Indicates the Fragment instance to be collected.
      • ignoreViewType

         static void ignoreViewType(Class<out Object> viewType)

        Ignores control click events of the specified type.

        Parameters:
        viewType - view type
      • ignoreAutoTrackActivity

         static void ignoreAutoTrackActivity(Class<out Object> activity)

        Ignore automatic collection events for multiple pages, including page browsing and control clicks.

        Parameters:
        activity - single activity
      • ignoreAutoTrackActivities

         static void ignoreAutoTrackActivities(List<Class<out Object>> activitiesList)

        Ignore automatic collection events for multiple pages, including page browsing and control clicks.

        Parameters:
        activitiesList - list of activity
      • setViewID

         static void setViewID(View view, String viewID)

        Custom control ID. If this parameter is not specified, android:id is used by default.

        Parameters:
        view - widget
        viewID - widget ID
      • setViewID

         static void setViewID(Dialog view, String viewID)

        Custom control ID. If this parameter is not specified, android:id is used by default.

        Parameters:
        view - dialog view
        viewID - widget ID
      • setViewProperties

         static void setViewProperties(View view, JSONObject properties)

        Customize the properties of the control click event.

        Parameters:
        view - Control that you want to set custom properties
        properties - properties
      • ignoreView

         static void ignoreView(View view)

        Ignores control click events of the specified view.

        Parameters:
        view - widget
      • setJsBridge

         static void setJsBridge(WebView webView)

        Support H5 to connect with native APP SDK.This function is called when the WebView is initialized.

        Parameters:
        webView - WebView instance
      • setJsBridgeForX5WebView

         static void setJsBridgeForX5WebView(Object x5WebView)

        Tencent X5 WebView gets through with native APP SDK.

        Parameters:
        x5WebView - WebView instance