Show Menu
TOPICS×

Collect commerce and products

If you have products on your site, then this is a default set of things you might want to send to enable the most capabilities from Adobe. Though this is a suggestion, it provides a very strong set of data right from the start.
This document uses the ExperienceEvent Commerce Details mixin. The commerce mixin is broken into two parts: the commerce object and the productListItems array. The commerce object lets you indicate which actions are happening to the productListItems array.
If you are familiar with Adobe Analytics, The commerce is most closely related to the events variable. The productListItems is more closely related to the products variable.

Lists of products

The product list indicates which products are related to the corresponding action. It is a list of productListItems . Each product has a number of optional fields.
Field
Recommendation
Description
Optional
The ISO 4217 currency for for the product. This is only useful when you can have products with different currency codes and when it applies. For example, when there is a purchase or add to cart.
Highly Recommended
Should only be set when applicable. For example, it might not be possible to set on productView because different variations of the product can have different prices but on a productListAdds .
Highly Recommended
The XDM ID for the product.
Highly Recommended
The method that was used to add a product item to the list by the visitor. Set with productListAdds measures, and should only be used when a product is added to the list. Examples include add to cart button , quick add , and upsell .
Highly Recommended
This is set to the display name or human-readable name of the product.
Highly Recommended
The number of units the customer has indicated they require of the product. Should be set on productListAdds , productListRemoves , purchases , saveForLaters , and so on.
Highly Recommended
Store Keeping Unit. It is the unique identifier for the product.

Examples

productView event
alloy("sendEvent",{
  "xdm":{
    "commerce":{
      "productViews":{
        "value":1
      }
    },
    "productListItems":[
      {
        "SKU":"HT105",
        "name":"The Big Floppy Hat",
      },
      {
        "SKU":"HT104",
        "name":"The Small Floppy Hat",
      }
    ]
  }
});

productView event
alloy("sendEvent",{
  "xdm":{
    "commerce":{
      "productListAdds":{
        "value":1
      }
    },
    "productListItems":[
      {
        "SKU":"HT105",
        "name":"The Big Floppy Hat",
        "quantity":1,
        "priceTotal":29.99,
        "productAddMethod":"Add to Cart Button"
      },
      {
        "SKU":"HT104",
        "name":"The Small Floppy Hat",
        "quantity":1,
        "priceTotal":9.99,
        "productAddMethod":"Add-on"
      }
    ]
  }
});

checkout event
alloy("sendEvent",{
  "xdm":{
    "commerce":{
      "checkouts":{
        "value":1
      }
    },
    "productListItems":[
      {
        "SKU":"HT105",
        "name":"The Big Floppy Hat",
        "quantity":1,
        "priceTotal":29.99
      },
      {
        "SKU":"HT104",
        "name":"The Small Floppy Hat",
        "quantity":1,
        "priceTotal":9.99
      }
    ]
  }
});

purchase event
alloy("sendEvent",{
  "xdm":{
    "commerce":{
      "order":{
        "purchaseID":"123456789",
        "currencyCode":"USD",
        "priceTotal":39.98,
        "payments":[
          {
            "transactionID":"amx12345",
            "paymentAmount":39.98,
            "paymentType":"credit_card",
            "currencyCode":"USD"
          }
        ]
      }
    },
    "productListItems":[
      {
        "SKU":"HT105",
        "name":"The Big Floppy Hat",
        "priceTotal":29.99,
        "quantity":1
      },
      {
        "SKU":"HT104",
        "name":"The Small Floppy Hat",
        "priceTotal":9.99,
        "quantity":1
      }
    ]
  }
});