Package com.mparticle.commerce
Class CommerceEvent
- java.lang.Object
-
- com.mparticle.BaseEvent
-
- com.mparticle.commerce.CommerceEvent
-
public final class CommerceEvent extends BaseEvent
The canonical object used to measure a commerce-related datapoint. This class is highly flexible and can be used to encapsulate user-interactions with Products, Promotions, or Impressions of Products. CommerceEvent objects should generally be considered immutable, several Builder classes are provided to help you construct new CommerceEvent objects. TheCommerceApihelper methods, accessed viaMParticle.getInstance().Commerce(), are a wrapper around this class and will generate and log CommerceEvent objects for you.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classCommerceEvent.BuilderThe Builder class forCommerceEvent.-
Nested classes/interfaces inherited from class com.mparticle.BaseEvent
BaseEvent.MessageType, BaseEvent.Type
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object o)java.lang.StringgetCheckoutOptions()Retrieve the Checkout options of the CommerceEvent.java.lang.IntegergetCheckoutStep()Retrieve the Checkout Step of the CommerceEvent.java.lang.StringgetCurrency()Retrieve the currency code associated with the CommerceEvent.java.lang.StringgetEventName()Retrieve the event name associated with the CommerceEvent.java.util.List<Impression>getImpressions()Retrieve theImpressionlist associated with the CommerceEvent.com.mparticle.internal.messages.BaseMPMessageBuildergetMessage()java.lang.BooleangetNonInteraction()Retrieve the boolean indicating if the event was triggered by a user.java.lang.StringgetProductAction()Retrieve the Product action of the event.java.lang.StringgetProductListName()Retrieve the Product List Name associated with the CommerceEvent.java.lang.StringgetProductListSource()Retrieve the product list source associated with the CommerceEvent.java.util.List<Product>getProducts()Retrieve the list of Products to which the CommerceEvent applies.java.lang.StringgetPromotionAction()Retrieve the Promotion action of the CommerceEvent.java.util.List<Promotion>getPromotions()Retrieve thePromotionlist associated with the CommerceEvent.java.lang.StringgetScreen()Retrieve the Screen where the event occurred.TransactionAttributesgetTransactionAttributes()Retrieve theTransactionAttributesobject associated with the CommerceEvent.inthashCode()java.lang.StringtoString()-
Methods inherited from class com.mparticle.BaseEvent
getCustomAttributes, getCustomFlags, getType, isShouldUploadEvent, setCustomAttributes, setCustomFlags, setShouldUploadEvent, setType
-
-
-
-
Method Detail
-
toString
@NonNull public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
getScreen
@Nullable public java.lang.String getScreen()
Retrieve the Screen where the event occurred.- Returns:
- the String descriptor/name of the Screen where this event occurred, or null if this is not set.
-
getNonInteraction
@Nullable public java.lang.Boolean getNonInteraction()
Retrieve the boolean indicating if the event was triggered by a user.- Returns:
- a Boolean indicating if this event was triggered by a user, or null if not set.
-
getProductAction
@Nullable public java.lang.String getProductAction()
Retrieve the Product action of the event. CommerceEvents are either Product, Promotion, or Impression based. The Product Action will be null in the case of Promotion and Impression CommerceEvents.- Returns:
- a String indicating the Product action, or null if this is not a Product-based CommerceEvent.
- See Also:
Builder(java.lang.String, com.mparticle.commerce.Product).,Product
-
getCheckoutStep
@Nullable public java.lang.Integer getCheckoutStep()
Retrieve the Checkout Step of the CommerceEvent. This should typically only be set in the case of aProduct.CHECKOUTCommerceEvent.- Returns:
- an Integer representing the step, or null if none is set.
-
getCheckoutOptions
@Nullable public java.lang.String getCheckoutOptions()
Retrieve the Checkout options of the CommerceEvent. This describes custom options that a user may select at particular steps in the checkout process.- Returns:
- a String describing any checkout options, or null if none are set.
-
getProductListName
@Nullable public java.lang.String getProductListName()
Retrieve the Product List Name associated with the CommerceEvent. This value should be set forProduct.DETAILandProduct.CLICKCommerceEvents.- Returns:
- the product list name, or null if not set.
-
getProductListSource
@Nullable public java.lang.String getProductListSource()
Retrieve the product list source associated with the CommerceEvent. This value should be set forProduct.DETAILandProduct.CLICKCommerceEvents.- Returns:
- the product list source, or null if not set.
-
getTransactionAttributes
@Nullable public TransactionAttributes getTransactionAttributes()
Retrieve theTransactionAttributesobject associated with the CommerceEvent.- Returns:
- the TransactionAttributes object, or null if not set.
-
getProducts
@Nullable public java.util.List<Product> getProducts()
Retrieve the list of Products to which the CommerceEvent applies. This should only be set for Product-type CommerceEvents.- Returns:
- the list of Products, or null if not set.
- See Also:
Builder(java.lang.String, com.mparticle.commerce.Product).
-
getPromotionAction
@Nullable public java.lang.String getPromotionAction()
Retrieve the Promotion action of the CommerceEvent. CommerceEvents are either Product, Promotion, or Impression based. The Promotion Action will be null in the case of Product and Impression CommerceEvents.- Returns:
- a String indicating the Promotion action, or null if this is not a Promotion-based CommerceEvent.
- See Also:
Builder(java.lang.String, com.mparticle.commerce.Promotion),for supported product actions.
-
getPromotions
@Nullable public java.util.List<Promotion> getPromotions()
Retrieve thePromotionlist associated with the CommerceEvent.- Returns:
- returns an unmodifiable List of Promotions, or null if this is a
ProductorImpressionbasedCommerceEvent. - See Also:
Builder(java.lang.String, com.mparticle.commerce.Promotion).
-
equals
public boolean equals(@Nullable java.lang.Object o)- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
getImpressions
@Nullable public java.util.List<Impression> getImpressions()
Retrieve theImpressionlist associated with the CommerceEvent.- Returns:
- returns an unmodifiable List of Impressions, or null if this is a
ProductorPromotionbasedCommerceEvent. - See Also:
Builder(java.lang.String, com.mparticle.commerce.Impression).
-
getCurrency
@Nullable public java.lang.String getCurrency()
Retrieve the currency code associated with the CommerceEvent.- Returns:
- returns a String representing the currency code, or null if not set.
-
getEventName
@Nullable public java.lang.String getEventName()
Retrieve the event name associated with the CommerceEvent. Most service providers do not require that this value is set.- Returns:
- the name associated with the CommerceEvent, or null if not set.
-
getMessage
public com.mparticle.internal.messages.BaseMPMessageBuilder getMessage()
- Overrides:
getMessagein classBaseEvent
-
-