public class

Promotion

extends Object
java.lang.Object
   ↳ com.google.android.gms.analytics.ecommerce.Promotion

Class Overview

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());
     

Summary

Constants
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 Constructors
Promotion()
Public Methods
Promotion setCreative(String value)
Sets the name of the creative associated with the promotion.
Promotion setId(String value)
Sets the id that is used to identify a promotion in GA reports.
Promotion setName(String value)
Sets the name that is used to identify the promotion in GA reports.
Promotion setPosition(String value)
Sets the position of the promotion.
[Expand]
Inherited Methods
From class java.lang.Object

Constants

public static final String ACTION_CLICK

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

Constant Value: "click"

public static final String ACTION_VIEW

Action to use when the user views a promotion.

Constant Value: "view"

Public Constructors

public Promotion ()

Public Methods

public Promotion setCreative (String value)

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.

public Promotion setId (String value)

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.

public Promotion setName (String value)

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.

public Promotion setPosition (String value)

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.