Collect commerce, product, and order information
If your organization sells products or services, you can use this page as a guide on how to track those products and services.
This page uses the XDM Commerce Schema field group.
This field group consists of two main parts:
- The
commerce
object. This object lets you indicate which actions happen to theproductListItems
array. - The
productListItems
array.
commerce
object contains data similar to commerce events in the events
variable. The productListItems
object array contains data similar to the products
variable.The commerce
object commerce-object
This section describes the fields available in the commerce
object.
id
and value
. Most of the time, you only use the value
field (for example, 'value':1
). The id
field allows you to set a unique identifier for tracking when the measure was sent. See the XDM documentation for Measure for more information.productListItems
at the same time.productListItems
.Commerce
object examples
Expand the section below to see an example of a Web SDK command using a field from the commerce
object.
productViews
A basic Web SDK sendEvent
call setting the productViews
field to 1
:
code language-javascript |
---|
|
The order
object order-object
The commerce
object contains a dedicated object for collecting order details. This is called the order
object.
This section describes all the fields supported by the order
object.
credit_card
, gift_card
, paypal
). See the list of known values for details.Order object examples
Expand the section below to see an example of a Web SDK command using the commerce
object.
Order
object exampleA Web SDK sendEvent
call setting the order
object that applies to multiple products in the productListItems
array:
code language-javascript |
---|
|
The product list object product-list-object
The product list indicates which products are related to the corresponding action. It is a list of productListItems. Each product has several optional fields.
productView
event because different variations of the product can have different prices but on a productListAdds
event.productListAdds
measures and only used when a product is added to the list. Examples include add to cart button
, quick add
, and upsell
.productListAdds
, productListRemoves
, purchases
, saveForLaters
, and so on.Product list examples
Expand the sections below to see examples of Web SDK commands using the productListItems
object.
productListItems
exampleA Web SDK sendEvent
call setting the productViews
for multiple products in the productListItems
array:
code language-javascript |
---|
|
productListAdds
examplaeA Web SDK sendEvent
call setting the productListAdds
event for multiple products in the productListItems
array:
code language-javascript |
---|
|
checkouts
exampleA Web SDK sendEvent
call setting the checkouts
event for multiple products in the productListItems
array:
code language-javascript |
---|
|