Use the Shopper Context API to add personalization features for your shoppers, such as:
- Sending a specific promotion based on the shopper’s store selection.
- Giving early access to products if the shopper is at a specific location.
You can use the Shopper Context API to track contextual information about a shopper, such as location, device type, and more. You can even set a date and time in the future to preview responses for upcoming site changes.
The context is valid for 1 day for guest shoppers and 7 days for registered shoppers. To extend the context set, create a new context. As a best practice, refresh your contexts periodically to ensure that the right personalized experience is rendered for your shoppers.
Until now, B2C Commerce has relied on session-based information to provide information about the shopper. In a headless world, as APIs become stateless, new mechanisms are needed to provide details about the shopper. To handle this, we’ve introduced the new Shopper Context API.
To use the Shopper Context API, you must use the Shopper Login (SLAS) API. For making calls to Shopper Context APIs, a valid SLAS token is needed.
Let’s look at a shopper’s personalized journey while browsing for jackets in the Northern Trail Outfitters shopping app:
- She visits the shopping app and starts as a guest shopper
- She’s from Seattle and notices that signing up to receive email promotions gets 15% off her purchase.
- After signing up, she logs into the shopping app. The two contexts reveal that:
- She’s browsing from the city of Seattle.
- She’s logged into the shopping app.
- She takes advantage of the 15% off and makes a purchase!
As with all APIs, never store access tokens in the browser because this creates a security vulnerability.