This guide describes the method in which to get a/b test information (the users in the test and which variant they fall within) into other analytics providers.
At the beginning of each user's app session, Leanplum assigns a Variant ID for each A/B test that is applicable for the user. For example, suppose a user qualifies for two tests:
- Test A
- Test B
Suppose the user is assigned "Variant 1" on "Test A" and "Control" on "Test B". Leanplum will give the user two variant IDs: 6331369890775040 and 5702495255396352.
The app only has the Leanplum Variant IDs for several reasons:
- It is more efficient for the app to only receive the numeric IDs, because they are more compact than receiving the entire test name and variant name.
- The test names and variant names can be changed later in the dashboard, which would cause data to not match. The numeric Variant IDs are persistent and guaranteed unique.
- For security, we do not want the end user to be able to see the names of the A/B tests or variants.
Use Leanplum's API to extract users' variant ID for Test A and Test B. Use the exportUsers call.
The SDK start call response returns the variables that have changed for the user - Have the SDK pass this response to your backend. Start call response.
Next you may want the ability to map these numeric variant ids into human-readable names.
Leanplum provides an API that gives you information on translating Variant IDs back into human-readable names. The most comprehensive API call is getAbTests.
This will return information about all A/B Tests and Variants for a specific app. From this information, you can determine that 6331369890775040 is "Variant 1" in "Test A" and 5702495255396352 is "Control" in "Test B".