public final class MyTracker
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static interface |
MyTracker.AttributionListener
Attribution listener interface.
|
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
VERSION
Library version
|
| Modifier and Type | Method and Description |
|---|---|
static void |
applyPlugin(MyTrackerPluginConfig pluginConfig)
This method could be used to apply additional plugin.
|
static void |
flush()
Force sending all saved events to the server.
|
static java.lang.String |
getInstanceId(android.content.Context context)
Return current instance id of tracker.
|
static MyTrackerConfig |
getTrackerConfig()
Return the instance of
MyTrackerConfig. |
static MyTrackerParams |
getTrackerParams()
Return the instance of
MyTrackerParams. |
static java.lang.String |
handleDeeplink(android.content.Intent intent)
The method for processing deeplink to application.
|
static void |
initTracker(java.lang.String id,
android.app.Application application)
Perform initialization of tracker.
|
static boolean |
isDebugMode()
Return the attribute whether the tracker prints debug information.
|
static void |
onActivityResult(int resultCode,
android.content.Intent data)
The method is used for tracking purchases when autotracking purchases is enabled
with
MyTrackerConfig.setAutotrackingPurchaseEnabled(boolean). |
static void |
onPurchasesUpdated(int responseCode,
java.util.List<java.lang.Object> purchases)
The method is used for tracking purchases when autotracking purchases is enabled
with
MyTrackerConfig.setAutotrackingPurchaseEnabled(boolean). |
static void |
setAttributionListener(MyTracker.AttributionListener attributionListener)
Set the attribution listener.
|
static void |
setAttributionListener(MyTracker.AttributionListener attributionListener,
android.os.Handler handler)
Set the attribution listener.
|
static void |
setDebugMode(boolean debugMode)
Enable or disable printing debug information.
|
static void |
trackAdEvent(AdEvent adEvent)
Track advertising event.
|
static void |
trackEvent(java.lang.String name)
Track user defined event with custom name.
|
static void |
trackEvent(java.lang.String name,
java.util.Map<java.lang.String,java.lang.String> eventParams)
Track user defined event with custom name and optional key-value parameters.
|
static void |
trackInviteEvent()
Track user invitation event.
|
static void |
trackInviteEvent(java.util.Map<java.lang.String,java.lang.String> eventParams)
Track user invitation event.
|
static void |
trackLaunchManually(android.app.Activity activity)
This method could be used in rare cases when tracker isn't able
to correctly identify application start.
|
static void |
trackLevelEvent()
Track achieving new level.
|
static void |
trackLevelEvent(int level,
java.util.Map<java.lang.String,java.lang.String> eventParams)
Track achieving new level.
|
static void |
trackLevelEvent(java.util.Map<java.lang.String,java.lang.String> eventParams)
Track achieving new level.
|
static void |
trackLoginEvent(java.lang.String userId,
java.lang.String vkConnectId)
Track user login event.
|
static void |
trackLoginEvent(java.lang.String userId,
java.lang.String vkConnectId,
java.util.Map<java.lang.String,java.lang.String> eventParams)
Track user login event.
|
static void |
trackMiniAppEvent(MiniAppEvent miniAppEvent)
Track mini-app event.
|
static void |
trackPurchaseEvent(org.json.JSONObject skuDetails,
org.json.JSONObject purchaseData,
java.lang.String dataSignature)
Track purchase event.
|
static void |
trackPurchaseEvent(org.json.JSONObject skuDetails,
org.json.JSONObject purchaseData,
java.lang.String dataSignature,
java.util.Map<java.lang.String,java.lang.String> eventParams)
Track purchase event.
|
static void |
trackRegistrationEvent(java.lang.String userId,
java.lang.String vkConnectId)
Track user registration event.
|
static void |
trackRegistrationEvent(java.lang.String userId,
java.lang.String vkConnectId,
java.util.Map<java.lang.String,java.lang.String> eventParams)
Track user registration event.
|
@AnyThread public static boolean isDebugMode()
@AnyThread public static void setDebugMode(boolean debugMode)
debugMode - If true, the tracker prints debug information to LogCat.@AnyThread
public static void setAttributionListener(@Nullable
MyTracker.AttributionListener attributionListener)
attributionListener - The instance of MyTracker.AttributionListener or null.@AnyThread
public static void setAttributionListener(@Nullable
MyTracker.AttributionListener attributionListener,
@Nullable
android.os.Handler handler)
attributionListener - The instance of MyTracker.AttributionListener or null.handler - The instance of Handler which will be used for invocation listener.@AnyThread @NonNull public static MyTrackerParams getTrackerParams()
MyTrackerParams.@AnyThread @NonNull public static MyTrackerConfig getTrackerConfig()
MyTrackerConfig.@AnyThread
public static void initTracker(@NonNull
java.lang.String id,
@NonNull
android.app.Application application)
NOTE: this method should be called right after setup tracker configuration.
NOTE: it's supposed that this method should be called in
Application.onCreate().
id - The identifier of your application.application - The instance of application.@AnyThread public static void flush()
@AnyThread
public static void trackEvent(@NonNull
java.lang.String name,
@Nullable
java.util.Map<java.lang.String,java.lang.String> eventParams)
name - User defined event name. Max length is 255 symbols.eventParams - Additional event key-value parameters. Max length for key or value is 255 symbols.@AnyThread
public static void trackEvent(@NonNull
java.lang.String name)
name - User defined event name. Max length is 255 symbols.@AnyThread
public static void trackLoginEvent(@NonNull
java.lang.String userId,
@Nullable
java.lang.String vkConnectId,
@Nullable
java.util.Map<java.lang.String,java.lang.String> eventParams)
NOTE: Call the method right after user successfully authorized in the app and got an unique identifier.
userId - Unique user identifier.vkConnectId - VK Connect user identifier.eventParams - Additional event key-value parameters. Max length for key or value is 255 symbols.@AnyThread
public static void trackLoginEvent(@NonNull
java.lang.String userId,
@Nullable
java.lang.String vkConnectId)
NOTE: Call the method right after user successfully authorized in the app and got an unique identifier.
userId - Unique user identifier.vkConnectId - VK Connect user identifier.@AnyThread
public static void trackRegistrationEvent(@NonNull
java.lang.String userId,
@Nullable
java.lang.String vkConnectId,
@Nullable
java.util.Map<java.lang.String,java.lang.String> eventParams)
NOTE: Call the method right after user successfully registered in the app and got an unique identifier.
userId - Unique user identifier.eventParams - Additional event key-value parameters. Max length for key or value is 255 symbols.@AnyThread
public static void trackRegistrationEvent(@NonNull
java.lang.String userId,
@Nullable
java.lang.String vkConnectId)
NOTE: Call the method right after user successfully registered in the app and got an unique identifier.
userId - Unique user identifier.@AnyThread
public static void trackInviteEvent(@Nullable
java.util.Map<java.lang.String,java.lang.String> eventParams)
eventParams - Additional event key-value parameters. Max length for key or value is 255 symbols.@AnyThread public static void trackInviteEvent()
@AnyThread
public static void trackLevelEvent(@Nullable
java.util.Map<java.lang.String,java.lang.String> eventParams)
eventParams - Additional event key-value parameters. Max length for key or value is 255 symbols.@AnyThread public static void trackLevelEvent()
@AnyThread
public static void trackLevelEvent(int level,
@Nullable
java.util.Map<java.lang.String,java.lang.String> eventParams)
level - The level that has been achieved.eventParams - Additional event key-value parameters. Max length for key or value is 255 symbols.@AnyThread
public static void trackAdEvent(@NonNull
AdEvent adEvent)
adEvent - Instance of AdEvent@AnyThread
public static void trackMiniAppEvent(@NonNull
MiniAppEvent miniAppEvent)
miniAppEvent - Instance of MiniAppEvent@AnyThread
public static void trackPurchaseEvent(@NonNull
org.json.JSONObject skuDetails,
@NonNull
org.json.JSONObject purchaseData,
@NonNull
java.lang.String dataSignature,
@Nullable
java.util.Map<java.lang.String,java.lang.String> eventParams)
skuDetails - The result of getSkuDetails.purchaseData - The field INAPP_PURCHASE_DATA of getBuyIntent.dataSignature - The field INAPP_DATA_SIGNATURE of getBuyIntent.eventParams - Additional event key-value parameters. Max length for key or value is 255 symbols.@AnyThread
public static void trackPurchaseEvent(@NonNull
org.json.JSONObject skuDetails,
@NonNull
org.json.JSONObject purchaseData,
@NonNull
java.lang.String dataSignature)
skuDetails - The result of getSkuDetails.purchaseData - The field INAPP_PURCHASE_DATA of getBuyIntent.dataSignature - The field INAPP_DATA_SIGNATURE of getBuyIntent.@AnyThread
public static void trackLaunchManually(@NonNull
android.app.Activity activity)
activity - The start activity.@AnyThread
public static void onActivityResult(int resultCode,
@Nullable
android.content.Intent data)
MyTrackerConfig.setAutotrackingPurchaseEnabled(boolean).
This method should be called in Activity.onActivityResult(int, int, Intent).resultCode - The resultCode from Activity.onActivityResult(int, int, Intent).data - The data from Activity.onActivityResult(int, int, Intent).@AnyThread
public static void onPurchasesUpdated(int responseCode,
@Nullable
java.util.List<java.lang.Object> purchases)
MyTrackerConfig.setAutotrackingPurchaseEnabled(boolean).
This method should be called in PurchasesUpdatedListener.onPurchasesUpdated(BillingResult, List).responseCode - The value of BillingResult.getResponseCode().purchases - List of purchases received on PurchasesUpdatedListener.onPurchasesUpdated(BillingResult, List).@AnyThread
@Nullable
public static java.lang.String handleDeeplink(@Nullable
android.content.Intent intent)
Activity.onNewIntent(Intent) or
in Activity.startActivity(Intent).intent - The intent with deeplink.@AnyThread
public static void applyPlugin(@NonNull
MyTrackerPluginConfig pluginConfig)
NOTE: it's mandatory to call this method before
initTracker(String, Application) call.
pluginConfig - The instance of plugin configuration.@WorkerThread
@NonNull
public static java.lang.String getInstanceId(@NonNull
android.content.Context context)
context - Instance of class Context.