API Docs for: 2.18.0
Show:

mParticle.eCommerce Class

Invoke these methods on the mParticle.eCommerce object. Example: mParticle.eCommerce.createImpresion(...)

Methods

createImpression

(
  • name
  • product
)

Creates a product impression

Parameters:

  • name String

    impression name

  • product Object

    the product for which an impression is being created

createProduct

(
  • name
  • sku
  • price
  • [quantity]
  • [variant]
  • [category]
  • [brand]
  • [position]
  • [coupon]
  • [attributes]
)

Creates a product

Parameters:

  • name String

    product name

  • sku String

    product sku

  • price Number

    product price

  • [quantity] Number optional

    product quantity. If blank, defaults to 1.

  • [variant] String optional

    product variant

  • [category] String optional

    product category

  • [brand] String optional

    product brand

  • [position] Number optional

    product position

  • [coupon] String optional

    product coupon

  • [attributes] Object optional

    product attributes

createPromotion

(
  • id
  • [creative]
  • [name]
  • [position]
)

Creates a promotion

Parameters:

  • id String

    a unique promotion id

  • [creative] String optional

    promotion creative

  • [name] String optional

    promotion name

  • [position] Number optional

    promotion position

createTransactionAttributes

(
  • id
  • [affiliation]
  • [couponCode]
  • [revenue]
  • [shipping]
  • [tax]
)

Creates a transaction attributes object to be used with a checkout

Parameters:

  • id String or Number

    a unique transaction id

  • [affiliation] String optional

    affilliation

  • [couponCode] String optional

    the coupon code for which you are creating transaction attributes

  • [revenue] Number optional

    total revenue for the product being purchased

  • [shipping] String optional

    the shipping method

  • [tax] Number optional

    the tax amount

getIntegrationAttributes

(
  • integrationId
)
Object

Get integration attributes for a given integration ID.

Parameters:

  • integrationId Number

    mParticle integration ID

Returns:

Object:

an object map of the integrationId's attributes

logCheckout

(
  • step
  • option
  • attrs
  • [customFlags]
)
deprecated

Logs a checkout action

Parameters:

  • step Number

    checkout step number

  • option String
  • attrs Object
  • [customFlags] Object optional

    Custom flags for the event

logImpression

(
  • impression
  • attrs
  • [customFlags]
  • [eventOptions]
)

Logs a product impression

Parameters:

  • impression Object

    product impression object

  • attrs Object

    attributes related to the impression log

  • [customFlags] Object optional

    Custom flags for the event

  • [eventOptions] Object optional

    For Event-level Configuration Options

logProductAction

(
  • productActionType
  • product
  • [attrs]
  • [customFlags]
  • [transactionAttributes]
  • [eventOptions]
)

Logs a product action

Parameters:

  • productActionType Number

    product action type as found here

  • product Object

    the product for which you are creating the product action

  • [attrs] Object optional

    attributes related to the product action

  • [customFlags] Object optional

    Custom flags for the event

  • [transactionAttributes] Object optional

    Transaction Attributes for the event

  • [eventOptions] Object optional

    For Event-level Configuration Options

logPromotion

(
  • type
  • promotion
  • [attrs]
  • [customFlags]
  • [eventOptions]
)

Logs a product promotion

Parameters:

  • type Number

    the promotion type as found here

  • promotion Object

    promotion object

  • [attrs] Object optional

    boolean to clear the cart after logging or not

  • [customFlags] Object optional

    Custom flags for the event

  • [eventOptions] Object optional

    For Event-level Configuration Options

logPurchase

(
  • transactionAttributes
  • product
  • [clearCart]
  • [attrs]
  • [customFlags]
)
deprecated

Logs a product purchase

Parameters:

  • transactionAttributes Object

    transactionAttributes object

  • product Object

    the product being purchased

  • [clearCart] Boolean optional

    boolean to clear the cart after logging or not. Defaults to false

  • [attrs] Object optional

    other attributes related to the product purchase

  • [customFlags] Object optional

    Custom flags for the event

logRefund

(
  • transactionAttributes
  • product
  • [clearCart]
  • [attrs]
  • [customFlags]
)
deprecated

Logs a refund

Parameters:

  • transactionAttributes Object

    transaction attributes related to the refund

  • product Object

    product being refunded

  • [clearCart] Boolean optional

    boolean to clear the cart after refund is logged. Defaults to false.

  • [attrs] Object optional

    attributes related to the refund

  • [customFlags] Object optional

    Custom flags for the event

setCurrencyCode

(
  • code
)

Sets the currency code

Parameters:

  • code String

    The currency code

setIntegrationAttribute

(
  • integrationId
  • attrs
)

Set or remove the integration attributes for a given integration ID. Integration attributes are keys and values specific to a given integration. For example, many integrations have their own internal user/device ID. mParticle will store integration attributes for a given device, and will be able to use these values for server-to-server communication to services. This is often useful when used in combination with a server-to-server feed, allowing the feed to be enriched with the necessary integration attributes to be properly forwarded to the given integration.

Parameters:

  • integrationId Number

    mParticle integration ID

  • attrs Object

    a map of attributes that will replace any current attributes. The keys are predefined by mParticle. Please consult with the mParticle docs or your solutions consultant for the correct value. You may also pass a null or empty map here to remove all of the attributes.

setOptOut

(
  • isOptingOut
)

Set opt out of logging

Parameters:

  • isOptingOut Boolean

    boolean to opt out or not. When set to true, opt out of logging.

setSessionAttribute

(
  • key
  • value
)

Sets a session attribute

Parameters:

  • key String

    key for session attribute

  • value String or Number

    value for session attribute