Promotion | Android Developers

Quicknav Quicknav
Links

- Google Play Developer Console
- Android Developers Blog
- About Android

Android Sites

- Android.com
- Android Developers
- Android Open Source Project

Language
close

- - About
  - Wear
  - TV
  - Auto
- - Get Started
  - Devices
  - Style
  - Patterns
  - Building Blocks
  - Downloads
  - Videos
- - Training
  - API Guides
  - Reference
  - Tools
  - Google Services
  - Samples
- - Google Play
  - Essentials
  - Get Users
  - Engage & Retain
  - Monetize
  - Tools & Reference
  - Developer Stories

## Results

Loading...
Summary: Constants | Ctors | Methods | Inherited Methods | [Expand All]
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
Object | clone()
boolean | equals(Object arg0)
void | finalize()
final Class<?> | getClass()
int | hashCode()
final void | notify()
final void | notifyAll()
String | toString()
final void | wait()
final void | wait(long arg0, int arg1)
final void | wait(long arg0)

## 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.