Package cn.thinkingdata.analytics
Class TDAnalytics
- java.lang.Object
-
- cn.thinkingdata.analytics.TDAnalytics
-
- All Implemented Interfaces:
ITDAnalytics
- Direct Known Subclasses:
ThinkingDataAnalytics
public class TDAnalytics extends Object implements ITDAnalytics
Entry of SDK
-
-
Constructor Summary
Constructors Constructor Description TDAnalytics(ITDConsumer consumer)Construct functionTDAnalytics(ITDConsumer consumer, boolean enableUUID)Construct functionTDAnalytics(ITDConsumer consumer, boolean enableUUID, boolean isStrictModel)Construct function
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclearSuperProperties()clear common propertiesvoidclose()close and exit sdkstatic voidenableLog(boolean isPrintLog)Is enabled log or not.voidflush()report data immediatelyMap<String,Object>getSuperProperties()get super propertiesvoidsetDynamicSuperPropertiesTracker(DynamicSuperPropertiesTracker dynamicSuperPropertiesTracker)set common properties dynamically.static voidsetLogger(ITDLogger logger)Developers can set up a custom logging system based on requirementsvoidsetSuperProperties(Map<String,Object> properties)Sets the properties that each event carriesvoidtrack(String accountId, String distinctId, String eventName, Map<String,Object> properties)Report normal eventvoidtrackFirst(String accountId, String distinctId, String eventName, String firstCheckId, Map<String,Object> properties)Report first eventvoidtrackOverwrite(String accountId, String distinctId, String eventName, String eventId, Map<String,Object> properties)Report overwrite eventvoidtrackUpdate(String accountId, String distinctId, String eventName, String eventId, Map<String,Object> properties)Report update eventvoidunsetSuperProperties(String key)delete property by keyvoiduserAdd(String accountId, String distinctId, Map<String,Object> properties)To accumulate operations against the propertyvoiduserAppend(String accountId, String distinctId, Map<String,Object> properties)To add user properties of array typevoiduserDelete(String accountId, String distinctId)Delete a user, This operation is not reversiblevoiduserSet(String accountId, String distinctId, Map<String,Object> properties)Set user properties.voiduserSetOnce(String accountId, String distinctId, Map<String,Object> properties)Set user properties, this message would be neglected If such property had been set beforevoiduserUniqAppend(String accountId, String distinctId, Map<String,Object> properties)Append user properties to array type by unique.voiduserUnset(String accountId, String distinctId, String... properties)Clear the user properties of users
-
-
-
Constructor Detail
-
TDAnalytics
public TDAnalytics(ITDConsumer consumer)
Construct function- Parameters:
consumer- BatchConsumer or LoggerConsumer or DebugConsumer
-
TDAnalytics
public TDAnalytics(ITDConsumer consumer, boolean enableUUID)
Construct function- Parameters:
consumer- BatchConsumer or LoggerConsumer or DebugConsumerenableUUID- Whether to allow uuid creation for events automatically
-
TDAnalytics
public TDAnalytics(ITDConsumer consumer, boolean enableUUID, boolean isStrictModel)
Construct function- Parameters:
consumer- BatchConsumer or LoggerConsumer or DebugConsumerenableUUID- Whether to allow uuid creation for events automaticallyisStrictModel- Whether to enable property verification
-
-
Method Detail
-
enableLog
public static void enableLog(boolean isPrintLog)
Is enabled log or not. it is enabled in DebugConsumer- Parameters:
isPrintLog- enabled
-
setLogger
public static void setLogger(ITDLogger logger)
Developers can set up a custom logging system based on requirements- Parameters:
logger- custom logger
-
track
public void track(String accountId, String distinctId, String eventName, Map<String,Object> properties) throws InvalidArgumentException
Report normal event- Specified by:
trackin interfaceITDAnalytics- Parameters:
accountId- account IDdistinctId- distinct IDeventName- nameproperties- properties- Throws:
InvalidArgumentException- exception
-
trackFirst
public void trackFirst(String accountId, String distinctId, String eventName, String firstCheckId, Map<String,Object> properties) throws InvalidArgumentException
Report first event- Specified by:
trackFirstin interfaceITDAnalytics- Parameters:
accountId- account IDdistinctId- distinct IDeventName- event nameproperties- properties (must add "#first_check_id" in properties, because it is flag of the first event)firstCheckId- it is flag of the first event- Throws:
InvalidArgumentException- exception
-
trackUpdate
public void trackUpdate(String accountId, String distinctId, String eventName, String eventId, Map<String,Object> properties) throws InvalidArgumentException
Report update event- Specified by:
trackUpdatein interfaceITDAnalytics- Parameters:
accountId- account IDdistinctId- distinct IDeventName- event nameeventId- event idproperties- properties- Throws:
InvalidArgumentException- exception
-
trackOverwrite
public void trackOverwrite(String accountId, String distinctId, String eventName, String eventId, Map<String,Object> properties) throws InvalidArgumentException
Report overwrite event- Specified by:
trackOverwritein interfaceITDAnalytics- Parameters:
accountId- account IDdistinctId- distinct IDeventName- event nameeventId- event idproperties- properties- Throws:
InvalidArgumentException- exception
-
setSuperProperties
public void setSuperProperties(Map<String,Object> properties)
Sets the properties that each event carries- Specified by:
setSuperPropertiesin interfaceITDAnalytics- Parameters:
properties- common properties
-
getSuperProperties
public Map<String,Object> getSuperProperties()
Description copied from interface:ITDAnalyticsget super properties- Specified by:
getSuperPropertiesin interfaceITDAnalytics- Returns:
- Map
-
unsetSuperProperties
public void unsetSuperProperties(String key)
Description copied from interface:ITDAnalyticsdelete property by key- Specified by:
unsetSuperPropertiesin interfaceITDAnalytics- Parameters:
key- property name
-
clearSuperProperties
public void clearSuperProperties()
Description copied from interface:ITDAnalyticsclear common properties- Specified by:
clearSuperPropertiesin interfaceITDAnalytics
-
setDynamicSuperPropertiesTracker
public void setDynamicSuperPropertiesTracker(DynamicSuperPropertiesTracker dynamicSuperPropertiesTracker)
Description copied from interface:ITDAnalyticsset common properties dynamically. not recommend to add the operation which with a lot of computation- Specified by:
setDynamicSuperPropertiesTrackerin interfaceITDAnalytics- Parameters:
dynamicSuperPropertiesTracker- properties
-
userDelete
public void userDelete(String accountId, String distinctId) throws InvalidArgumentException
Delete a user, This operation is not reversible- Specified by:
userDeletein interfaceITDAnalytics- Parameters:
accountId- account IDdistinctId- distinct ID- Throws:
InvalidArgumentException- exception
-
userAdd
public void userAdd(String accountId, String distinctId, Map<String,Object> properties) throws InvalidArgumentException
To accumulate operations against the property- Specified by:
userAddin interfaceITDAnalytics- Parameters:
accountId- account IDdistinctId- distinct IDproperties- properties- Throws:
InvalidArgumentException- exception
-
userSetOnce
public void userSetOnce(String accountId, String distinctId, Map<String,Object> properties) throws InvalidArgumentException
Set user properties, this message would be neglected If such property had been set before- Specified by:
userSetOncein interfaceITDAnalytics- Parameters:
accountId- account IDdistinctId- distinct IDproperties- properties- Throws:
InvalidArgumentException- exception
-
userSet
public void userSet(String accountId, String distinctId, Map<String,Object> properties) throws InvalidArgumentException
Set user properties. would overwrite existing names- Specified by:
userSetin interfaceITDAnalytics- Parameters:
accountId- account IDdistinctId- distinct IDproperties- properties- Throws:
InvalidArgumentException- exception
-
userUnset
public void userUnset(String accountId, String distinctId, String... properties) throws InvalidArgumentException
Clear the user properties of users- Specified by:
userUnsetin interfaceITDAnalytics- Parameters:
accountId- account IDdistinctId- distinct IDproperties- properties- Throws:
InvalidArgumentException- exception
-
userAppend
public void userAppend(String accountId, String distinctId, Map<String,Object> properties) throws InvalidArgumentException
To add user properties of array type- Specified by:
userAppendin interfaceITDAnalytics- Parameters:
accountId- account IDdistinctId- distinct IDproperties- properties- Throws:
InvalidArgumentException- exception
-
userUniqAppend
public void userUniqAppend(String accountId, String distinctId, Map<String,Object> properties) throws InvalidArgumentException
Append user properties to array type by unique.- Specified by:
userUniqAppendin interfaceITDAnalytics- Parameters:
accountId- account IDdistinctId- distinct IDproperties- properties- Throws:
InvalidArgumentException- exception
-
flush
public void flush()
Description copied from interface:ITDAnalyticsreport data immediately- Specified by:
flushin interfaceITDAnalytics
-
close
public void close()
Description copied from interface:ITDAnalyticsclose and exit sdk- Specified by:
closein interfaceITDAnalytics
-
-