The purpose of this method is to force a user into a specific variation for a given experiment. The forced variation value doesn't persist across application launches.
SDK v1.0.0 and higher
Forces a user into a variation for a given experiment for the lifetime of the Optimizely client. Any future calls to [Activate](🔗), [Is Feature Enabled](🔗), [Get Feature Variable](🔗), and [Track](🔗) for the given user ID returns the forced variation.
Forced bucketing variations take precedence over whitelisted variations, variations saved in a User Profile Service (if one exists), and the normal bucketed variation. Impression and conversion events are still tracked when forced bucketing is enabled.
Variations are overwritten with each set method call. To clear the forced variations so that the normal bucketing flow can occur, use [Remove Variation](🔗) method of passed ExperimentOverridesStore service. To get the variation that has been forced, use [Get Variation](🔗) method of passed ExperimentOverridesStore service.
This table lists the required parameters for the Go SDK.
|**overrideKey** _All keys inside object are also required_||ExperimentOverrideKey||ExperimentOverrideKey contains, - _ExperimentKey (string)_: The key of the experiment to set with the forced variation. - _UserID (string)_: The ID of the user to force into the variation.|
|**variationKey** _required_||string||The key of the forced variation.|
Creating client with Forced variation service and then setting forced variation:
## See also
[Get Variation](🔗) [Remove Variation](🔗)
## Source files
The language/platform source files containing the implementation for Go is [client.go](🔗).