You are here:
A/B Testing for Developers in B2C Commerce
Use the Salesforce B2C Commerce APIs if you want to use more than promotions, sorting rules, and slots to create a unique A/B testing user experience. This topic applies to B2C Commerce.
For each test segment, include effects in templates that change business logic, visual elements, or other user experiences based on test group participation. Use the B2C Commerce API to determine participation in a specific group of a specific test. Then use this information in conditional logic to alter the experience for participants of the segment in various ways.
Configure a test group that has automatically applied effects, custom effects or both.
To create a custom test experience for a test segment, set the Enable/Disable Custom Scripting setting for that segment within the Business Manager A/B test module. By enabling this setting, you’re notifying B2C Commerce that the specific A/B test segment includes more changes to the storefront that you implement in script. For example, to select a different price book, create a pipeline that makes a price book available to participants in a specific test group.
Caching Impact
Assuming that every A/B test group can have a custom experience through a script leads to caching performance problems. These problems occur because B2C Commerce caches a different version of each page for participants in each A/B test segment. It caches different version in case the script affects the segments differently. Instead, B2C Commerce assumes that only the segments where the Enable Custom Scripting setting is set cache separately.
If you write a script and don’t indicate that a segment has a custom experience, then the cached version of the page is based on the participating segment for the first storefront customer to access the page. Thereafter, all storefront customers get the page as if they were in that segment. If the first storefront customer isn't a participant in any test segments, then it eliminates custom experiences for that page for all test segments.

