HomeDev GuideAPI Reference
Dev GuideAPI ReferenceUser GuideGitHubNuGetDev CommunitySubmit a ticketLog In
GitHubNuGetDev CommunitySubmit a ticket

Basket page

Describes how to configure tracking requests on a basket page.

To track a basket page, provide a list of products in the basket along with the currency, quantity and price.



In Optimizely Commerce, a basket is known as a shopping cart or a cart.

The quantity and price elements should be the same as the ones the user is viewing. So if there is a discount, provide the discounted price.

Price is the price per unit. For example, if a basket has 3 units, and each unit costs Β£10, the value of price is 10.

Name Description and usage
Basket Element containing basket specific sub-elements.
  items List of checkout items.


Product reference code.

The refCode must exactly match the refCode (guid) in the product catalog feed. If you have a custom feed, contact Optimizely to find out which field from the feed is a product identifier.
    qty  [Number]

    price [Number]

Unit price.
    variant [Optional]

The product variant’s SKU code. Alternatively, the product variant’s colour and size attributes can be supplied instead.

By arrangement with Optimizely, these can be replaced with another product attribute.

Sub-elements are of the type [String].

See the Variant tracking section.
  currency Currency code.

See Currency codes.
  basketId [Optional]

Link a specific shopping basket in a Trigger campaign. See Link to a specific basket.

Basket page tracking request example.

      "type"        : "basket",
      "ip"          : "",
      "session"     : "123456789012|a1b2c3d4e5A6B7C8D9E0f1g2h3i4j5F1G2H3I4J5k1l",
      "cuid"        : "09876543210|Z0Y9X8W7V6z5y4x3w2v1U0T9S8R7Q6u5t4s3r2q1P0O",
      "site"        : "retailer",
      "clientToken" : "1234abcd5678",
      "channel"     : "web",
      "lang"        : "en-gb",
      "currentURI"  : "www.retailer.com/basket.html",
      "previousURI" : "www.retailer.com/product/RC123.html",
      "userAgent"   : "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36",
      "basket"      : {
                        "items"    : [
                                       { "refCode" : "RC123", "qty" : 5, "price" : 50.5 },
                                       { "refCode" : "RC124", "qty" : 8, "price" : 52.5 }
                        "currency" : "GBP"