Package com.mparticle.commerce
Class Promotion
- java.lang.Object
-
- com.mparticle.commerce.Promotion
-
public class Promotion extends java.lang.Object
Class representing an internal promotions within an app, such as banners. This class exposes constants to be used in conjection with aCommerceEvent
to track when a Promotion is viewed or tapped. ExampleCommerceEvent
usage:Promotion promotion = new Promotion() .setName("my banner ad") .setId("ad_001") .setCreative("hero image"); CommerceEvent promotionEvent = new CommerceEvent.Builder(Promotion.CLICK, promotion).build(); MParticle.getInstance().logEvent(promotionEvent);
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
getCreative()
Get the description of the creative in this Promotion.java.lang.String
getId()
Get the unique ID of this Promotion.java.lang.String
getName()
Get the name associated with this Promotion.java.lang.String
getPosition()
Get the position of this Promotion on the page.Promotion
setCreative(java.lang.String creative)
Set the name of the creative to associate with this Promotion.Promotion
setId(java.lang.String id)
Set a unique ID to associate with this Promotion.Promotion
setName(java.lang.String name)
Set a name to associate with this Promotion.Promotion
setPosition(java.lang.String position)
Set the description of the position of this Promotion on the page.java.lang.String
toString()
-
-
-
Field Detail
-
CLICK
@NonNull public static final java.lang.String CLICK
The Promotion action constant used to track when a user taps or clicks on a Promotion.- See Also:
- Constant Field Values
-
VIEW
@NonNull public static final java.lang.String VIEW
The Promotion action constant used to track when a user views a Promotion.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
Promotion
public Promotion()
Create an empty Promotion. You should typically at least set the ID or Name of a Promotion.
-
Promotion
public Promotion(@NonNull Promotion promotion)
Copy constructor to duplicate an existing Promotion.- Parameters:
promotion
- return the duplicated Promotion object
-
-
Method Detail
-
getCreative
@Nullable public java.lang.String getCreative()
Get the description of the creative in this Promotion.- Returns:
- returns the name of the creative associated with this Promotion
-
setCreative
@NonNull public Promotion setCreative(@Nullable java.lang.String creative)
Set the name of the creative to associate with this Promotion.- Parameters:
creative
-- Returns:
- returns this Promotion object for easy method chaining
-
getId
@Nullable public java.lang.String getId()
Get the unique ID of this Promotion.- Returns:
-
setId
@NonNull public Promotion setId(@Nullable java.lang.String id)
Set a unique ID to associate with this Promotion.- Parameters:
id
-- Returns:
- returns this Promotion object for easy method chaining
-
getName
@Nullable public java.lang.String getName()
Get the name associated with this Promotion.- Returns:
-
setName
@NonNull public Promotion setName(@Nullable java.lang.String name)
Set a name to associate with this Promotion.- Parameters:
name
-- Returns:
- returns this Promotion object for easy method chaining
-
getPosition
@Nullable public java.lang.String getPosition()
Get the position of this Promotion on the page.- Returns:
-
setPosition
@NonNull public Promotion setPosition(@Nullable java.lang.String position)
Set the description of the position of this Promotion on the page.- Parameters:
position
-- Returns:
- returns this Promotion object for easy method chaining
-
toString
@NonNull public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-