Tracker
Provides support for sending hits to Google Analytics using convenient named methods like sendAppView and sendEvent or the general purpose send method.

Clients can set session values using set. These values, once set, are included in all subsequent hits.

For analytics hittypes that are not supported by a named method clients can call send with param/value Object describing the hit. Obtain a instance using the analytics.Service#getTracker.

Inheritance

Constructor

analytics.Tracker()

Instance Methods

addFilter(filter)
Adds a analytics.Tracker.Filter to the request handling pipeline. The filter will be called once for each hit, immediately after the hit is sent.
  • Filters will not be applied when tracking is disabled by the user.
  • Filters are applied in the order they are added.
  • Arguments:
    filter : !analytics.Tracker.Filter
    No description.
    send(hitTypeopt_extraParams) !goog.async.Deferred
    Sends a hit to Google Analytics. Caller is responsible for ensuring the of the information sent with that hit. Values can be provided either using set or using opt_extraParams.

    Whenever possible use a named method like sendAppView or sendEvent.

    Arguments:
    hitType : !analytics.HitType | !analytics.EventBuilder
    The hitType or an EventBuilder. If EventBuilder the hitType and opt_extraParams are collected from this object, and opt_extraParams will be ignored.
    opt_extraParams : (!analytics.ParameterMap |  !Object.<string, !analytics.Value>)>
    Additional parameters to include in the hit along with any values previously supplied via calls to Tracker#set. NOTE: These values are NOT persisted in the tracker.
    Returns: !goog.async.Deferred  No description.
    sendAppView(description) !goog.async.Deferred
    Sends an AppView hit to Google Analytics.
    Arguments:
    description : string
    A unique description of the "screen" ( or "place, or "view") within your application. This is should more specific than your app name, but generally not include any runtime data. In most cases all "screens" should be known at the time the app is built. Examples: "MainScreen" or "SettingsView".
    Returns: !goog.async.Deferred  No description.
    sendEvent(categoryactionopt_labelopt_value) !goog.async.Deferred
    Sends an Event hit to Google Analytics.
    Arguments:
    category : string
    Specifies the event category.
    action : string
    Specifies the event action.
    opt_label : string=
    Specifies the event label.
    opt_value : number=
    Specifies the event value. Values must be non-negative.
    Returns: !goog.async.Deferred  No description.
    sendException(opt_descriptionopt_fatal) !goog.async.Deferred
    Sends an Exception hit to Google Analytics.
    Arguments:
    opt_description : string=
    Specifies the description of an exception.
    opt_fatal : boolean=
    Was the exception fatal.
    Returns: !goog.async.Deferred  No description.
    sendSocial(networkactiontarget) !goog.async.Deferred
    Sends a Social hit to Google Analytics.
    Arguments:
    network : string
    Specifies the social network, for example Facebook or Google Plus.
    action : string
    Specifies the social interaction action. For example on Google Plus when a user clicks the +1 button, the social action is 'plus'.
    target : string
    Specifies the target of a social interaction. This value is typically a URL but can be any text.
    Returns: !goog.async.Deferred  No description.
    sendTiming(categoryvariablevalueopt_labelopt_sampleRate) !goog.async.Deferred
    Sends a Timing hit to Google Analytics.
    Arguments:
    category : string
    Specifies the category of the timing.
    variable : string
    Specifies the variable name of the timing.
    value : number
    Specifies the value of the timing.
    opt_label : string=
    Specifies the optional label of the timing.
    opt_sampleRate : number=
    No description.
    Returns: !goog.async.Deferred  No description.
    set(paramvalue)
    Sets an individual value on the Tracker, replacing any previously set values with the same param. The value is persistent for the life of the Tracker instance, or until replaced with another call to set.
    Arguments:
    param : !analytics.Parameter | string
    No description.
    value : !analytics.Value
    No description.
    startTiming(categoryvariableopt_labelopt_sampleRate) !analytics.Tracker.Timing
    Creates a new timing object that tracks elapsed time for you.
    Arguments:
    category : string
    No description.
    variable : string
    No description.
    opt_label : string=
    No description.
    opt_sampleRate : number=
    No description.
    Returns: !analytics.Tracker.Timing  No description.

    Instance Properties

    forceSessionStart :
    Forces the tracker up to start a new session on the next hit. Note that clients should not usually need to call this as Google Analytics provides automatic session management.

    Static Properties

    analytics.Tracker.Filter :
    A function that processes a hit.

    Package Tracker

    Package Reference