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

Link to a specific basket

Describes how to set up abandoned basket trigger campaigns to link to a particular basket with the abandoned products.

📘

Note

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

There are 3 main areas to consider:

  • Changes to basket page tracking.
  • Steps for the Email Service Provider (ESP).
  • Populating the basket with abandoned products.

Basket page tracking

To restore a basket for a session, you need to pass a basketId value in the Optimizely tracking variable. The basketId should be unique for a user’s session on your site and must relate back to a basket state stored on the your side.

To extend the basket page tracking to track the basketId, include a string value in the tracking variable. For example:

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

Optimizely then associates the basketId with that session and can be passed to the ESP if the session satisfies the rules set up for the trigger campaign.

Steps for the Email Service Provider (ESP)

For the ESP to receive the basketId during the trigger process, you will need to notify Optimizely with your intention to use this feature, so it can be enabled for your ESP’s integration with our service.

Once the ESP is set up to accept the basketId variable through Optimizely, the ESP will need to catch the basketId variable that is passed as part of the trigger and use this to create a link to the basket page on your site.

Adestra ESP

For example, the email campaign template includes a button to complete an order, which has a link to the basket on the client site:

https://www.my-site.com/cart?optimizelyBasketId=transaction.peeriusBasketId

Adestra ESP replaces the placeholder transaction.peeriusBasketId with the basketId value sent as part of the trigger when sending out the email.

Optimizely ESP for email campaigns

📘

Note

To add a new standard field called externalbasketid to Reach-related recipient lists, contact customer support.

For example, the email campaign template includes a button to complete an order, which has a link to the basket on the client site:

https://www.my-site.com/cart?optimizelyBasketId={externalbasketid}

Optimizely ESP replaces the placeholder {externalbasketid} with the basketId value sent as part of the trigger when sending out the email.

Populate the basket with abandoned products

When the user clicks on the link to view their abandoned basket, check the basketId parameter passed with the request and pull the last-known products from your side for that basketId, because Optimizely does not send the abandoned products as part of the trigger.

This process is unique to the setup of your site but you should have the functionality to pull the last-known basketed products for the basketId and add these to the current basket for that user.

It is important that the products match those that the user abandoned.