|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Tracker
This defines the interface for doing Analytics tracking. A Tracker is responsible for tracking a particular web property.
Only track calls queue hits to be dispatched.
Method Summary | |
---|---|
boolean |
anonymizeIpEnabled()
Returns whether or not anonymize IP mode is on. |
void |
close()
Closes the session. |
java.util.Map<java.lang.String,java.lang.String> |
constructEvent(java.lang.String category,
java.lang.String action,
java.lang.String label,
java.lang.Long value)
Creates model fields for an event. |
java.util.Map<java.lang.String,java.lang.String> |
constructException(java.lang.String exceptionDescription,
boolean fatal)
Creates model fields for an exception. |
java.util.Map<java.lang.String,java.lang.String> |
constructRawException(java.lang.String threadName,
java.lang.Throwable exception,
boolean fatal)
Creates model fields for an exception. |
java.util.Map<java.lang.String,java.lang.String> |
constructSocial(java.lang.String network,
java.lang.String action,
java.lang.String target)
Creates model fields for social. |
java.util.Map<java.lang.String,java.lang.String> |
constructTiming(java.lang.String category,
long intervalInMilliseconds,
java.lang.String name,
java.lang.String label)
Creates model fields for timing. |
java.util.Map<java.lang.String,java.lang.String> |
constructTransaction(Transaction trans)
Creates model fields for a transaction. |
java.lang.String |
get(java.lang.String key)
Gets the model value for the given key. |
java.lang.String |
getAppId()
|
java.lang.String |
getAppInstallerId()
|
ExceptionParser |
getExceptionParser()
|
double |
getSampleRate()
Returns the sample rate. |
java.lang.String |
getTrackingId()
|
boolean |
getUseSecure()
Returns the current setting for useSecure. |
void |
send(java.lang.String hitType,
java.util.Map<java.lang.String,java.lang.String> params)
Tracks the given hit. |
void |
set(java.lang.String key,
java.lang.String value)
Sets the model value for the given key. |
void |
setAnonymizeIp(boolean anonymizeIp)
Turns on or off anonymize IP mode. |
void |
setAppId(java.lang.String appId)
Set the appId . |
void |
setAppInstallerId(java.lang.String appInstallerId)
Set the id of the app that installed this app. |
void |
setAppName(java.lang.String appName)
Set the application name to appName . |
void |
setAppScreen(java.lang.String appScreen)
Stores the place to be sent with subsequent track calls. |
void |
setAppVersion(java.lang.String appVersion)
Set the application version to appVersion . |
void |
setCampaign(java.lang.String campaign)
Set the campaign. |
void |
setCustomDimension(int slot,
java.lang.String value)
Sets the value for a custom dimension. |
void |
setCustomDimensionsAndMetrics(java.util.Map<java.lang.Integer,java.lang.String> dimensions,
java.util.Map<java.lang.Integer,java.lang.Long> metrics)
Sets the values for several custom dimensions and metrics at once. |
void |
setCustomMetric(int slot,
java.lang.Long value)
Sets the value for a custom metric. |
void |
setExceptionParser(ExceptionParser exceptionParser)
Sets the ExceptionParser to be used by this Tracker. |
void |
setReferrer(java.lang.String referrer)
Set the referrer. |
void |
setSampleRate(double sampleRate)
Sets the sample rate. |
void |
setStartSession(boolean startSession)
Specifies whether a new session should be started. |
void |
setUseSecure(boolean useSecure)
Determines whether hits are sent securely. |
void |
trackEvent(java.lang.String category,
java.lang.String action,
java.lang.String label,
java.lang.Long value)
Tracks an event. |
void |
trackException(java.lang.String description,
boolean fatal)
Tracks that an exception occurred. |
void |
trackException(java.lang.String threadName,
java.lang.Throwable exception,
boolean fatal)
Tracks that an exception occurred. |
void |
trackSocial(java.lang.String network,
java.lang.String action,
java.lang.String target)
Tracks a social hit. |
void |
trackTiming(java.lang.String category,
long intervalInMilliseconds,
java.lang.String name,
java.lang.String label)
Tracks a user timing hit. |
void |
trackTransaction(Transaction transaction)
Tracks an eCommerce transaction. |
void |
trackView()
Tracks entering a view with the current app screen name. |
void |
trackView(java.lang.String appScreen)
Tracks entering a view with a new app screen name. |
Method Detail |
---|
void setStartSession(boolean startSession)
If you don't explicitly mark session starts by calling setStartSession with a value of true, sessions will be created automatically on the backend.
By default, trackers are created with startSession set to true.
startSession
- true if a new session should be started with the next
hitvoid setAppName(java.lang.String appName)
appName
. If not set, the Tracker
will
use the package name.
Note that if this method is called after any tracking activity has happened, the call will be ignored.
void setAppVersion(java.lang.String appVersion)
appVersion
. If not set, the Tracker
will
use the version reported in the package.
Note that if this method is called after any tracking activity has happened, the call will be ignored.
void setAppScreen(java.lang.String appScreen)
appScreen
- the new app screen name (null or empty string clears any existing app screen
name)void trackView()
void trackView(java.lang.String appScreen)
appScreen
- the new app screen namevoid trackEvent(java.lang.String category, java.lang.String action, java.lang.String label, java.lang.Long value)
category
- the event categoryaction
- the event actionlabel
- the event labelvalue
- the event value. Pass null if no value is to be set.void trackTransaction(Transaction transaction)
void trackException(java.lang.String description, boolean fatal)
description
- the type of exceptionfatal
- true if the exception is fatalvoid trackException(java.lang.String threadName, java.lang.Throwable exception, boolean fatal)
ExceptionParser
class set for this tracker. See
setExceptionParser(com.google.analytics.tracking.android.ExceptionParser)
and StandardExceptionParser
.
threadName
- the name of the @{link Thread} that got the exception, or nullexception
- the Throwable
to reportfatal
- true if the exception is fatalvoid trackTiming(java.lang.String category, long intervalInMilliseconds, java.lang.String name, java.lang.String label)
category
- the category of the timingintervalInMilliseconds
- the timing interval, in millisecondsname
- the optional name of the timinglabel
- the optional labelvoid trackSocial(java.lang.String network, java.lang.String action, java.lang.String target)
network
- the social networkaction
- the social actiontarget
- the social targetvoid close()
Tracker
.
void send(java.lang.String hitType, java.util.Map<java.lang.String,java.lang.String> params)
ModelFields
in order for that value to appear in the hit.
hitType
- the type of the hitparams
- map of hit data to values which are appended to the existing
values which are already set (using set(java.lang.String, java.lang.String)
)java.lang.String get(java.lang.String key)
void set(java.lang.String key, java.lang.String value)
java.lang.String getTrackingId()
trackingId
used by this Tracker
void setAnonymizeIp(boolean anonymizeIp)
In the case of IPv4 addresses, the last octet is set to zero. For IPv6 addresses, the last 10 octets are set to zero, although this is subject to change in the future.
anonymizeIp
- if true, turns on anonymize IP modeboolean anonymizeIpEnabled()
void setSampleRate(double sampleRate)
When a visitor is not sampled, no data is submitted to Google Analytics about that visitor's activity. If your application is subject to heavy traffic spikes, you may wish to adjust the sample rate to ensure uninterrupted report tracking. Sampling in Google Analytics occurs consistently across unique visitors, ensuring integrity in trending and reporting even when sampling is enabled, because unique visitors remain included or excluded from the sample, as set from the initiation of sampling.
Note that sampleRate can be set down to hundredths of a percent.
sampleRate
- a value between 0.0 and 100.0double getSampleRate()
void setUseSecure(boolean useSecure)
useSecure
- if true, use Https to send hits, otherwise use Httpboolean getUseSecure()
void setReferrer(java.lang.String referrer)
referrer
- the new referrer informationvoid setCampaign(java.lang.String campaign)
Implementations should handle input of the form http://my.site.com/index.html?utm_campaign=wow&utm_source=source as well as input of the form utm_campaign=wow&utm_source=source.
For more information on auto-tagging, see http://support.google.com/googleanalytics/bin/answer.py?hl=en&answer=55590
For more information on manual tagging, see http://support.google.com/googleanalytics/bin/answer.py?hl=en&answer=55518
campaign
- the campaign information, as a sequence of URL parameters
separated by &void setAppId(java.lang.String appId)
appId
. By default, the appId
will be set to the
packageName of the application. This works for Google Play, but other
stores will have different appIds
. This method allows changing the
appId
for other stores.
appId
- the new appId
or nulljava.lang.String getAppId()
void setAppInstallerId(java.lang.String appInstallerId)
PackageManager#getInstallerPackageName
method.
appInstallerId
- the new appInstallerId
or nulljava.lang.String getAppInstallerId()
void setExceptionParser(ExceptionParser exceptionParser)
ExceptionParser
to be used by this Tracker.
ExceptionParser getExceptionParser()
ExceptionParser
currently in use for this Tracker.void setCustomDimension(int slot, java.lang.String value)
slot
- the dimension slotvalue
- the dimension value, or null to clear a previously set valuevoid setCustomMetric(int slot, java.lang.Long value)
slot
- the metric slotvalue
- the metric value, or null to clear a previously set valuevoid setCustomDimensionsAndMetrics(java.util.Map<java.lang.Integer,java.lang.String> dimensions, java.util.Map<java.lang.Integer,java.lang.Long> metrics)
dimensions
- a Map of the custom dimension slots to custom dimension
valuesmetrics
- a Map of the custom metric slots to custom metric valuesjava.util.Map<java.lang.String,java.lang.String> constructEvent(java.lang.String category, java.lang.String action, java.lang.String label, java.lang.Long value)
send(java.lang.String, java.util.Map)
.
java.util.Map<java.lang.String,java.lang.String> constructTransaction(Transaction trans)
send(java.lang.String, java.util.Map)
.
java.util.Map<java.lang.String,java.lang.String> constructException(java.lang.String exceptionDescription, boolean fatal)
send(java.lang.String, java.util.Map)
.
java.util.Map<java.lang.String,java.lang.String> constructRawException(java.lang.String threadName, java.lang.Throwable exception, boolean fatal) throws java.io.IOException
send(java.lang.String, java.util.Map)
.
java.io.IOException
java.util.Map<java.lang.String,java.lang.String> constructTiming(java.lang.String category, long intervalInMilliseconds, java.lang.String name, java.lang.String label)
send(java.lang.String, java.util.Map)
.
java.util.Map<java.lang.String,java.lang.String> constructSocial(java.lang.String network, java.lang.String action, java.lang.String target)
send(java.lang.String, java.util.Map)
.
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |