Promotion

public classPromotionextendsObject

Class to construct promotion related fields for Google Analytics hits. The fields from this class can be used to represent internal promotions that run within an app, such as banners, banner ads etc.

Typical usage:

ScreenViewBuilder builder = new HitBuilders.ScreenViewBuilder();

builder.setPromotionAction(Promotion.ACTION_CLICK)
.addPromotion(new Promotion().setId( "PROMO-ID1234" ).setName( "Home screen banner." ))
tracker.send(builder.build());

Constant Summary

String ACTION_CLICK Action to use when the user clicks/taps on a promotion.
String ACTION_VIEW Action to use when the user views a promotion.

Public Constructor Summary

Public Method Summary

Promotion
setCreative(Stringvalue)
Sets the name of the creative associated with the promotion.
Promotion
setId(Stringvalue)
Sets the id that is used to identify a promotion in GA reports.
Promotion
setName(Stringvalue)
Sets the name that is used to identify the promotion in GA reports.
Promotion
setPosition(Stringvalue)
Sets the position of the promotion.
String

Inherited Method Summary

Constants

public static finalString ACTION_CLICK

Action to use when the user clicks/taps on a promotion.

Constant Value:"click"

public static finalString ACTION_VIEW

Action to use when the user views a promotion.

Constant Value:"view"

Public Constructors

publicPromotion()

Public Methods

publicPromotion setCreative(Stringvalue)

Sets the name of the creative associated with the promotion.

Parameters
value The promotion creative's name. Example: "Cool pets creative"
Returns
  • Returns the same object to enable chaining of methods.

publicPromotion setId(Stringvalue)

Sets the id that is used to identify a promotion in GA reports.

Parameters
value The promotion's id.
Returns
  • Returns the same object to enable chaining of methods.

publicPromotion setName(Stringvalue)

Sets the name that is used to identify the promotion in GA reports.

Parameters
value The promotion's name. Example: "Home Banner"
Returns
  • Returns the same object to enable chaining of methods.

publicPromotion setPosition(Stringvalue)

Sets the position of the promotion.

Parameters
value The promotion's position. Example: "top" or "bottom".
Returns
  • Returns the same object to enable chaining of methods.

publicStringtoString()