Class 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. The CommerceApi helper methods, accessed via MParticle.getInstance().Commerce(), are a wrapper around this class and will generate and log CommerceEvent objects for you.
    See Also:
    CommerceEvent.Builder, MParticle.logEvent(BaseEvent)
    • Method Detail

      • toString

        @NonNull
        public java.lang.String toString()
        Overrides:
        toString in class java.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 a Product.CHECKOUT CommerceEvent.
        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 for Product.DETAIL and Product.CLICK CommerceEvents.
        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 for Product.DETAIL and Product.CLICK CommerceEvents.
        Returns:
        the product list source, or null if not set.
      • getTransactionAttributes

        @Nullable
        public TransactionAttributes getTransactionAttributes()
        Retrieve the TransactionAttributes object associated with the CommerceEvent.
        Returns:
        the TransactionAttributes object, or null if not set.
      • 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.
      • equals

        public boolean equals​(@Nullable
                              java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • 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:
        getMessage in class BaseEvent