Disclaimer: This website requires Please enable JavaScript in your browser settings for the best experience.

HomeDev GuideAPI Reference
Dev GuideAPI ReferenceUser GuideLegal TermsDev CommunityOptimizely AcademySubmit a ticketLog In
Dev Guide

Basket page

Tracked by providing a list of products in the basket along with the quantity, currency, and unit price.

Quantity and unit price should match what the site visitor sees. So if there is a discount, the discounted price is provided.

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

refCode

Product reference code.
  qty [Number]

Quantity.
    price [Number]

Unit price.
  currency Currency code.
  basketId [Optional]

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

See also Currency codes.

A basket page is tracked using the following script.

{
      "type"   : "basket",
      "lang"   : "en-gb",
      "basket" : {
        "items"    : [{
          "refCode" : "PROD500",
          "qty"     : 2,
          "price"   : 25.5
        },
        {
          "refCode" : "PROD600",
          "qty"     : 4,
          "price"   : 12.0
        }],
        "currency" : "GBP"
      }
    }

This example illustrates a basket with 6 items.

  • 2 units of PROD500 @ £25.50 each.
  • 4 units PROD600 @ £12.00 each.

📘

Note

You can also add the customAttributes or customer elements to this page tracking request. For more information, see Add customAttributes or customer elements (Optional).