public class TrackHelper
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static class |
TrackHelper.AppTracking |
static class |
TrackHelper.CartUpdate |
static class |
TrackHelper.ContentImpression |
static class |
TrackHelper.ContentInteraction |
static class |
TrackHelper.Dimension |
static class |
TrackHelper.Download |
static class |
TrackHelper.EventBuilder |
static class |
TrackHelper.Exception |
static class |
TrackHelper.Goal |
static class |
TrackHelper.Order |
static class |
TrackHelper.Outlink |
static class |
TrackHelper.Screen |
static class |
TrackHelper.Search |
static class |
TrackHelper.UncaughtExceptions |
static class |
TrackHelper.VisitVariables |
| Modifier and Type | Field and Description |
|---|---|
protected TrackMe |
mBaseTrackMe |
| Modifier and Type | Method and Description |
|---|---|
TrackHelper.CartUpdate |
cartUpdate(int grandTotal)
Tracks a shopping cart.
|
TrackHelper.Dimension |
dimension(int id,
java.lang.String value) |
TrackHelper.Download |
download() |
TrackHelper.Download |
download(DownloadTracker downloadTracker)
Sends a download event for this app.
|
TrackHelper.EventBuilder |
event(java.lang.String category,
java.lang.String action)
Events are a useful way to collect data about a user's interaction with interactive components of your app,
like button presses or the use of a particular item in a game.
|
TrackHelper.Exception |
exception(java.lang.Throwable throwable)
Caught exceptions are errors in your app for which you've defined exception handling code,
such as the occasional timeout of a network connection during a request for data.
|
TrackHelper.Goal |
goal(int idGoal)
By default, Goals in Piwik are defined as "matching" parts of the screen path or screen title.
|
TrackHelper.ContentImpression |
impression(java.lang.String contentName)
Tracking the impressions
|
TrackHelper.ContentInteraction |
interaction(java.lang.String contentName,
java.lang.String contentInteraction)
Tracking the interactions
|
TrackHelper.Order |
order(java.lang.String orderId,
int grandTotal)
Tracks an Ecommerce order, including any ecommerce item previously added to the order.
|
TrackHelper.Outlink |
outlink(java.net.URL url)
Tracks an Outlink
|
TrackHelper.Screen |
screen(android.app.Activity activity)
Calls
screen(String) for an activity. |
TrackHelper.Screen |
screen(java.lang.String path)
To track a screenview.
|
TrackHelper.AppTracking |
screens(android.app.Application app)
This method will bind a tracker to your application,
causing it to automatically track Activities with
screen(Activity) within your app. |
TrackHelper.Search |
search(java.lang.String keyword)
Tracks an site search
|
static TrackHelper |
track() |
static TrackHelper |
track(TrackMe base) |
TrackHelper.UncaughtExceptions |
uncaughtExceptions()
This will create an exception handler that wraps any existing exception handler.
|
TrackHelper.VisitVariables |
visitVariables(CustomVariables customVariables)
Deprecated.
Consider using Custom Dimensions
|
TrackHelper.VisitVariables |
visitVariables(int id,
java.lang.String name,
java.lang.String value)
Deprecated.
Consider using Custom Dimensions
|
protected final TrackMe mBaseTrackMe
public static TrackHelper track()
public static TrackHelper track(@Nullable TrackMe base)
public TrackHelper.Screen screen(java.lang.String path)
path - Example: "/user/settings/billing"public TrackHelper.Screen screen(android.app.Activity activity)
screen(String) for an activity.
Uses the activity-stack as path and activity title as names.activity - the activity to trackpublic TrackHelper.EventBuilder event(@NonNull java.lang.String category, @NonNull java.lang.String action)
category - (required) – this String defines the event category.
You might define event categories based on the class of user actions,
like clicks or gestures or voice commands, or you might define them based upon the
features available in your application (play, pause, fast forward, etc.).action - (required) this String defines the specific event action within the category specified.
In the example, we are basically saying that the category of the event is user clicks,
and the action is a button click.public TrackHelper.Goal goal(int idGoal)
idGoal - id of goal as defined in piwik goal settingspublic TrackHelper.Outlink outlink(java.net.URL url)
url - HTTPS, HTTP and FTPare validpublic TrackHelper.Search search(java.lang.String keyword)
keyword - Searched query in the apppublic TrackHelper.Download download(DownloadTracker downloadTracker)
Resulting download url:
Case DownloadTracker.Extra.ApkChecksum:
http://packageName:versionCode/apk-md5-checksum
Case DownloadTracker.Extra.None:
http://packageName:versionCode
public TrackHelper.Download download()
public TrackHelper.ContentImpression impression(@NonNull java.lang.String contentName)
contentName - The name of the content. For instance 'Ad Foo Bar'public TrackHelper.ContentInteraction interaction(@NonNull java.lang.String contentName, @NonNull java.lang.String contentInteraction)
To map an interaction to an impression make sure to set the same value for contentName and contentPiece as the impression has.
contentInteraction - The name of the interaction with the content. For instance a 'click'contentName - The name of the content. For instance 'Ad Foo Bar'public TrackHelper.CartUpdate cartUpdate(int grandTotal)
grandTotal - total value of items in cartpublic TrackHelper.Order order(java.lang.String orderId, int grandTotal)
orderId - (required) A unique string identifying the ordergrandTotal - (required) total amount of the order, in centspublic TrackHelper.Exception exception(java.lang.Throwable throwable)
This is just a different way to define an event. Keep in mind Piwik is not a crash tracker, use this sparingly.
For this to be useful you should ensure that proguard does not remove all classnames and line numbers. Also note that if this is used across different app versions and obfuscation is used, the same exception might be mapped to different obfuscated names by proguard. This would mean the same exception (event) is tracked as different events by Piwik.
throwable - exception instancepublic TrackHelper.UncaughtExceptions uncaughtExceptions()
Be wary of relying on this for complete crash tracking.. Think about how to deal with older app versions still throwing already fixed exceptions.
See discussion here: https://github.com/piwik/piwik-sdk-android/issues/28
public TrackHelper.AppTracking screens(android.app.Application app)
screen(Activity) within your app.app - your apppublic TrackHelper.Dimension dimension(int id, java.lang.String value)
@Deprecated public TrackHelper.VisitVariables visitVariables(int id, java.lang.String name, java.lang.String value)
CustomVariables.put(int, String, String)@Deprecated public TrackHelper.VisitVariables visitVariables(CustomVariables customVariables)