Salesforce ShopperContext API: How to Set It Up for Real Personalization
Learn how to configure the Salesforce ShopperContext API step by step to unlock session-based personalization in SFCC. Talk to Develoci about your setup.
The Salesforce ShopperContext API lets you attach session-level data to a shopper's storefront visit, which SFCC can then use to drive personalized promotions, content, and customer groups. Unlike older personalization approaches that relied on static customer attributes, ShopperContext works in real time, at the session level, without requiring a login or a persistent profile.
This guide walks through the exact configuration steps: enabling the feature switch, scoping your SLAS token correctly, building session-based customer groups, and testing the API endpoints before you wire it into production. If your team is deciding how to structure personalization in SFCC without over-engineering the front end, this is the sequence that works.
🎬 How to use the Salesforce ShopperContext API
Delivering personalized experiences has become a baseline expectation in e-commerce, not a differentiator. Salesforce built the ShopperContext API specifically to let development teams create tailored interactions without rebuilding the customer data model. Below is the step-by-step process to configure it correctly.
Step 1: Enable ShopperContext in Business Manager
Start in Business Manager and navigate to Administration > Global Preferences > Feature Switches. Find the "Enable ShopperContext" toggle and turn it on. This activates the ShopperContext API in your environment and exposes the endpoints your integration will call.
Step 2: Get a Valid SLAS Token
To interact with the ShopperContext API, you need a valid SLAS token. Make sure your API client has the sfcc.shopper-context.rw scope added to its configuration. This scope grants both read and write access to shopper context data, without it, every call to the API returns an authorization error regardless of how the rest of your setup looks.
Step 3: Build Session-Based Customer Groups
Session-based customer groups are where ShopperContext delivers most of its value. Use the API to create groups through session.custom, defining criteria based on device type, demographics, or any other attribute relevant to your business. This is the mechanism that lets you segment shoppers without waiting for them to log in or accumulate purchase history.
Step 4: Create Promotions and Campaigns for Each Group
Once your customer groups are in place, build promotions and campaigns targeted at each segment. Use the ShopperContext API to serve targeted discounts, special offers, and campaign content that match the preferences and behavior signals tied to each group. This is where the session data actually turns into a business result: higher conversion on segments that would otherwise see generic content.
Step 5: Test the ShopperContext API Endpoints
Before rolling this out to production, validate the endpoints using the Postman Collection linked below. Run requests against each endpoint and confirm that the shopper context data is being retrieved and applied the way you expect. Testing here catches session-handling edge cases (expired tokens, missing scopes, malformed group definitions) before they show up as support tickets.
Following this sequence, you can configure the Salesforce ShopperContext API and unlock the personalization it was built for: highly targeted promotions, tailored recommendations, and session-aware experiences that don't depend on a login.
Download the Postman Collection on our Github
Architecture Trade-offs: SFRA vs. Headless
It's worth noting that how the front end consumes this context data changes depending on your storefront architecture. Teams in the middle of an SFRA to PWA Kit migration need to review where and how ShopperContext is called, since SFRA's server-side rendering and PWA Kit's headless model handle session state and caching very differently. A call that works cleanly in a server-rendered SFRA template can behave inconsistently in a headless setup if cache boundaries and session persistence aren't re-mapped explicitly.
Implementing the ShopperContext API involves architecture decisions that go beyond the initial setup: data segmentation, SLAS integration, and deciding which context signals are actually worth capturing for your business model. Capturing too many signals adds overhead and complexity without a proportional lift in conversion, while capturing too few limits what personalization can realistically achieve.
If your team is evaluating how to structure scalable personalization in SFCC, schedule a call with Develoci to talk through the architecture that fits your context.
Por Fernando Ruch