Known Direct Subclasses |
Internal class to provide common builder class methods. The most important methods from this class are the setXYZ and build methods. These methods can be used to set individual properties on the hit and then build it so that it is ready to be passed into the tracker.
Protected Constructor Summary
Public Method Summary
T | |
T | |
T | |
Map<String, String> | |
final T | |
final T | |
T |
setCampaignParamsFromUrl(String utmParams)
Parses and translates utm campaign parameters to analytics campaign parameters
and returns them as a map.
|
T | |
T |
setCustomMetric(int index, float metric)
Adds a custom metric to the current hit builder.
|
T | |
T |
setNonInteraction(boolean nonInteraction)
|
T |
setProductAction(ProductAction
action)
Sets a product action for all the products included in this hit.
|
T |
Protected Method Summary
String | |
T |
Inherited Method Summary
Protected Constructors
protected HitBuilders.HitBuilder ()
Public Methods
public T addImpression (Product product, String impressionList)
Adds a product impression to the hit. The product can be optionally associated with a named impression list.
public T addProduct (Product product)
Adds product information to be sent with a given hit. The action provided in
setProductAction(ProductAction)
affects how the products passed in through
this method get processed.
public T addPromotion (Promotion promotion)
Adds promotion related information to the hit.
public final T set (String paramName, String paramValue)
Sets the value for the given parameter name. These values will be added to the hit when it is built. This function should only be used for advanced cases where none of the explicit setters do not work. This function should usually be called after all the explicit setter have been called.
Parameters
paramName | The name of the parameter that should be sent over wire. This value should start with "&". |
---|---|
paramValue | The value to be sent over the wire for the given parameter. |
Returns
- The builder object that you can use to chain calls.
public final T setAll (Map<String, String> params)
Adds a set of key, value pairs to the hit builder. These values will be added to the hit when it is built. This function should only be used for advanced cases where none of the explicit setters work. This function should usually be called after all the explicit setter have been called.
Parameters
params | A map of all the values to be added to the builder. |
---|
Returns
- The builder object that you can use to chain calls.
public T setCampaignParamsFromUrl (String utmParams)
Parses and translates utm campaign parameters to analytics campaign parameters and returns them as a map.
Parameters
utmParams | url containing utm campaign parameters. |
---|
Returns
- The builder object that you can use to chain calls.
Valid campaign parameters are:
- utm_id
- utm_campaign
- utm_content
- utm_medium
- utm_source
- utm_term
- dclid
- gclid
- gmob_t
Example: //my.site.com/index.html?utm_campaign=wow&utm_source=source utm_campaign=wow&utm_source=source.
For more information on auto-tagging, see //support.google.com/googleanalytics/bin/answer.py?hl=en&answer=55590
For more information on manual tagging, see //support.google.com/googleanalytics/bin/answer.py?hl=en&answer=55518 *
public T setCustomDimension (int index, String dimension)
Adds a custom dimension to the current hit builder. Calling this method with the same index will overwrite the previous dimension with the new one. Refer //goo.gl/igziD2 for details on how to set the custom dimensions up.
Parameters
index | The index/slot in which the dimension will be set. |
---|---|
dimension | The value of the dimension for the given index. |
Returns
- The builder object that you can use to chain calls.
public T setCustomMetric (int index, float metric)
Adds a custom metric to the current hit builder. Calling this method with the same index will overwrite the previous metric with the new one. Refer //goo.gl/igziD2 for details on how to set the custom metrics up.
Parameters
index | The index/slot in which the metric will be set. |
---|---|
metric | The value of the metric for the given index. |
Returns
- The builder object that you can use to chain calls.
public T setNewSession ()
public T setNonInteraction (boolean nonInteraction)
public T setProductAction (ProductAction action)
Sets a product action for all the products included in this hit. The action and its
associated properties affect how the products added through
addProduct(Product)
are processed.
Protected Methods
protected T setHitType (String hitType)
Sets the type of the hit to be sent. This can be used to reuse the builder object for multiple hit types. See //goo.gl/kMRwhS for possible hit values.
Parameters
hitType | The value of the Hit. |
---|