mParticle.eCommerce Class
Invoke these methods on the mParticle.eCommerce object. Example: mParticle.eCommerce.createImpresion(...)
Item Index
Methods
createImpression
-
name
-
product
Creates a product impression
Parameters:
-
name
Stringimpression name
-
product
Objectthe product for which an impression is being created
createProduct
-
name
-
sku
-
price
-
[quantity]
-
[variant]
-
[category]
-
[brand]
-
[position]
-
[coupon]
-
[attributes]
Creates a product
Parameters:
-
name
Stringproduct name
-
sku
Stringproduct sku
-
price
Numberproduct price
-
[quantity]
Number optionalproduct quantity. If blank, defaults to 1.
-
[variant]
String optionalproduct variant
-
[category]
String optionalproduct category
-
[brand]
String optionalproduct brand
-
[position]
Number optionalproduct position
-
[coupon]
String optionalproduct coupon
-
[attributes]
Object optionalproduct attributes
createPromotion
-
id
-
[creative]
-
[name]
-
[position]
Creates a promotion
Parameters:
-
id
Stringa unique promotion id
-
[creative]
String optionalpromotion creative
-
[name]
String optionalpromotion name
-
[position]
Number optionalpromotion position
createTransactionAttributes
-
id
-
[affiliation]
-
[couponCode]
-
[revenue]
-
[shipping]
-
[tax]
Creates a transaction attributes object to be used with a checkout
Parameters:
-
id
String or Numbera unique transaction id
-
[affiliation]
String optionalaffilliation
-
[couponCode]
String optionalthe coupon code for which you are creating transaction attributes
-
[revenue]
Number optionaltotal revenue for the product being purchased
-
[shipping]
String optionalthe shipping method
-
[tax]
Number optionalthe tax amount
getIntegrationAttributes
-
integrationId
Get integration attributes for a given integration ID.
Parameters:
-
integrationId
NumbermParticle integration ID
Returns:
an object map of the integrationId's attributes
logCheckout
-
step
-
option
-
attrs
-
[customFlags]
Logs a checkout action
Parameters:
-
step
Numbercheckout step number
-
option
String -
attrs
Object -
[customFlags]
Object optionalCustom flags for the event
logImpression
-
impression
-
attrs
-
[customFlags]
-
[eventOptions]
Logs a product impression
Parameters:
-
impression
Objectproduct impression object
-
attrs
Objectattributes related to the impression log
-
[customFlags]
Object optionalCustom flags for the event
-
[eventOptions]
Object optionalFor Event-level Configuration Options
logProductAction
-
productActionType
-
product
-
[attrs]
-
[customFlags]
-
[transactionAttributes]
-
[eventOptions]
Logs a product action
Parameters:
-
productActionType
Numberproduct action type as found here
-
product
Objectthe product for which you are creating the product action
-
[attrs]
Object optionalattributes related to the product action
-
[customFlags]
Object optionalCustom flags for the event
-
[transactionAttributes]
Object optionalTransaction Attributes for the event
-
[eventOptions]
Object optionalFor Event-level Configuration Options
logPromotion
-
type
-
promotion
-
[attrs]
-
[customFlags]
-
[eventOptions]
Logs a product promotion
Parameters:
-
type
Numberthe promotion type as found here
-
promotion
Objectpromotion object
-
[attrs]
Object optionalboolean to clear the cart after logging or not
-
[customFlags]
Object optionalCustom flags for the event
-
[eventOptions]
Object optionalFor Event-level Configuration Options
logPurchase
-
transactionAttributes
-
product
-
[clearCart]
-
[attrs]
-
[customFlags]
Logs a product purchase
Parameters:
-
transactionAttributes
ObjecttransactionAttributes object
-
product
Objectthe product being purchased
-
[clearCart]
Boolean optionalboolean to clear the cart after logging or not. Defaults to false
-
[attrs]
Object optionalother attributes related to the product purchase
-
[customFlags]
Object optionalCustom flags for the event
logRefund
-
transactionAttributes
-
product
-
[clearCart]
-
[attrs]
-
[customFlags]
Logs a refund
Parameters:
-
transactionAttributes
Objecttransaction attributes related to the refund
-
product
Objectproduct being refunded
-
[clearCart]
Boolean optionalboolean to clear the cart after refund is logged. Defaults to false.
-
[attrs]
Object optionalattributes related to the refund
-
[customFlags]
Object optionalCustom flags for the event
setCurrencyCode
-
code
Sets the currency code
Parameters:
-
code
StringThe 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
NumbermParticle integration ID
-
attrs
Objecta 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
Booleanboolean to opt out or not. When set to true, opt out of logging.
setSessionAttribute
-
key
-
value
Sets a session attribute
Parameters:
-
key
Stringkey for session attribute
-
value
String or Numbervalue for session attribute