Dev GuideAPI Reference
Dev GuideAPI ReferenceUser GuideGitHubNuGetDev CommunityDoc feedbackLog In
GitHubNuGetDev CommunityDoc feedback
Hey! These docs are for version 2.0, which is no longer officially supported. Click here for the latest version, 3.0!

**Forced bucketing** lets you programmatically put a user into a certain variation from within your code.


The QA approaches here are used to put yourself into a specific variation of an A/B Test or Feature Test. **They are not supported for rollouts yet**.

Forced bucketing allows you to force a user into a variation by calling the `Set Forced Variation` method of the SDK. This allows you to change variation assignments in real time, which is ideal for QAing experiments or sharing links to a variation with a colleague.

For example, if your test is running in a web server, you may want to use a query parameter to force a variation and facilitate testing of your experiment. To do this, you can detect a parameter in the URL such as `?force-opty-<experiment_key>=<variation_key>` or `?force-opty-my_optimizely_experiment=variation`. Parse this parameter and use the `Set Forced Variation` method to force that specific variation for the user prior to activating the experiment. After that functionality is set up, forcing yourself into each variation will be as simple as adding the parameter to your URL.

Unlike whitelisting, forced bucketing takes place immediately (meaning, without waiting for a datafile update) and has no limit on the number of users that can be forced. It is important to note that the `forcedVariations` field in the datafile is only related to whitelisted variations and **not** to variations set by this API.