Prepare your environment for A/B testing
On this page
A couple of steps will help you prepare your A/B testing environment.
Set-up click analytics
Because Algolia uses click and conversion rates to do comparative A/B testing, you must send click and conversion events first.
The Revenue Analytics feature includes sending purchase
and addToCart
conversion events.
This feature isn’t available on every plan. Refer to your pricing plan to see if it’s included.
Add unique user identifiers to your searches
Make sure every search is associated with a unique user identifier. This serves two purposes:
- Guarantees consistent variant assignment. Algolia assigns each new user to a variant based on their user ID. This assignment is stable as long as the same user ID is provided for subsequent search sessions.
- Ensures distribution integrity. Users remain in their assigned variant, which helps ensure reliable test results.
Algolia uses unique user tokens to ensure that the same user is always directed to the same variant. By default, the user token is the user’s IP address.
However, you should not rely on this behavior. We recommend that you explicitly create a unique user identifier that you can keep track of in your own application. The user identifier can be sent to Algolia with the userToken
parameter, or with the X-Algolia-UserToken
request header.
A/B testing
Once these steps are completed, you can follow the dashboard’s process to start, stop, and view your tests.
If you want to AB test an index’s setting in the dashboard, select the same index for both variants. A prompt will appear asking you which settings you want to test.