HomeDev GuideAPI Reference
Dev GuideAPI ReferenceUser GuideGitHubNuGetDev CommunityDoc feedbackLog In
GitHubNuGetDev CommunityDoc feedback


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:



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.