---
schema_version: "1"
id: 45f055a04e1cf2df13b8d31ecf737121945268a85dc677e685321d8d2df1a8cc
title: Custom A/B Testing for Developers in B2C Commerce
collection: admin
version: current
locale: en-us
portal_url: https://docs.salesforce.com/admin/current/en-us/cc/264-0-0/b2c_ab_testing_for_developers.md
canonical_url: https://help.salesforce.com/s/articleView?id=cc.b2c_ab_testing_for_developers.htm&release=264.0.0&type=5
source_site: help.salesforce.com
content_type: documentation
content_hash: 58442a5ea4a8c0557d5caab1e933e28dc2c209d0963635fd75e6a16ca48761e7
description: To use more than promotions, sorting rules, and slots to create a unique A/B testing user experience, use the Salesforce B2C Commerce APIs.
products:
  - Commerce
  - B2C Commerce
release: "264"
---
# Custom A/B Testing for Developers in B2C Commerce

To use more than promotions, sorting rules, and slots to create a unique A/B testing user experience, use the Salesforce B2C Commerce APIs.

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. Don't create a test segment without automatically applied effects (for example, sorting rules or promotions) or any custom effects via the scripting API. As a best practice, avoid creating this type of segment because it's the same as the control group and provides no useful results.

![Note](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-cc-b2c_merchandiser_administrator-264-0-0-production-enus/ea76f372-6cfa-42a6-8e7c-05c6df7abed8/images/icon_note.png)

Note B2C Commerce has no way to validate that custom effects have been applied for a test group.

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](https://help.salesforce.com/s/articleView?id=cc.b2c_caching_with_ab_testing.htm&release=264.0.0&type=5 "Salesforce B2C Commerce provides different page caching configurations.") 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.

![Warning](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-cc-b2c_merchandiser_administrator-264-0-0-production-enus/ea76f372-6cfa-42a6-8e7c-05c6df7abed8/images/icon_warning.png)

Warning If you use this setting but don't actually use a script, you can impact performance.