HomeGuidesAPI Reference
Submit Documentation FeedbackJoin Developer CommunityOptimizely GitHubOptimizely NuGetLog In

Basket page

The basket page is 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.

What’s Next
Did this page help you?