The Get Variation Name API allows you to retrieve the variation assigned to a user for a specific Full Stack A/B experiment without re-evaluating or re-activating the experiment.
This is useful when you want to:
Fetch the already assigned variation
Apply variation-specific logic at a later point in the user flow
Ensure consistency across multiple screens or actions
Using this API, you can:
Retrieve the variation already assigned to a user
Avoid duplicate experiment activation calls
Apply consistent behavior across different parts of your app
Safely handle users who are not part of the experiment
You should use this API when:
The experiment has already been activated for the user
You want to check the assigned variation again
You need variation information outside the initial activation flow
If the experiment has not been activated earlier, this API may return null.
User attributes can be passed when retrieving the variation name to ensure audience conditions are evaluated correctly.
KOTLIN
JAVA
Parameter | Type | Required | Description |
experimentName | String | Yes | Name of the Full Stack experiment configured in PageSense. |
userId | String | Yes | Unique and stable identifier for the user. Must remain consistent across sessions. |
userAttributes | Map<String, String> | No | Optional user attributes used for audience targeting and segmentation. |
When To Use activateExperiment() vs getVariationName()
Use Case | Recommended Method |
First-time evaluation | activateExperiment |
Retrieve already assigned variation | getVariationName |
If no user attributes are available, you can retrieve the variation using only the experiment name and user ID.
Only experiments targeting All Visitors will qualify in this case.
When activateExperiment() method is invoked, it follows a series of steps to determine whether a variation should be assigned to the user:
1. Audience Targeting
If the user’s attributes match the audience targeting conditions, the evaluation proceeds.
If they don’t match, the API immediately returns null, indicating the user is not eligible for the experiment.
2. User Storage Service
If a stored variation already exists for the given user Id for the experiment, it is retrieved from the storage and returned.
If not, the SDK proceeds to assign a new variation via hashing algorithm.
3. Hashing with MurmurHash
This hash value determines the user’s position in the experiment’s traffic allocation range and assign a variation.
MurmurHash always generates the same hash value for a given user ID and the experiment key combination.
This ensures that users always receive a consistent variation assignment across different sessions and browsers.
4. Variation Mapping
Variation | Value Range |
Original | 0 – 2000 |
Variation 1 | 2001 – 4000 |
Variation 2 | 4001 – 6000 |
Variation 3 | 6001 – 8000 |
These ranges are non-overlapping and collectively cover the experiment’s total traffic allocation.
If the user’s hash value falls within a particular variation’s range, that variation will be allocated to the user.
If the user’s hash value falls outside all assigned ranges for the variations, no variation will be assigned to the user and the user will not qualify for the experiment, and NULL will be returned for the variation.
5. Tracking and Analytics
6. Return Value
Outcome | Return Value |
User qualifies and variation allocated | Returns the variation name |
User does not match the audience targeting rules | Returns NULL |
User falls outside traffic allocation | Returns NULL |
This API does not activate an experiment
It only returns the variation already assigned to the user
If the user does not qualify or the experiment was never activated, null is returned
Always handle the null case safely
Activate the experiment once per user session
Use getVariationName for subsequent checks
Use a stable user identifier for consistent results
Pass user attributes only when available
Learn how to use the best tools for sales force automation and better customer engagement from Zoho's implementation specialists.
If you'd like a personalized walk-through of our data preparation tool, please request a demo and we'll be happy to show you how to get the best out of Zoho DataPrep.
All-in-one knowledge management and training platform for your employees and customers.
You are currently viewing the help pages of Qntrl’s earlier version. Click here to view our latest version—Qntrl 3.0's help articles.