Optimizely will be sunsetting Full Stack Experimentation on July 29, 2024. See the recommended Feature Experimentation migration timeline and documentation.

Dev GuideAPI Reference
Dev GuideAPI ReferenceUser GuideLegal TermsGitHubDev CommunityOptimizely AcademySubmit a ticketLog In
Dev Guide

Remove Forced Variation

This topic describes how to remove the forced variation.

Clears the forced variation set by Set Variation, so that the normal bucketing flow can occur.

Version

SDK v1.0.0 and higher

Description

Forced bucketing variations take precedence over whitelisted variations, variations saved in a User Profile Service (if one exists), and the normal bucketed variation. Variations are overwritten when Set Forced Variation is invoked.

Parameters

This table lists the required parameters for the Go SDK.

ParameterTypeDescription
overrideKey
All keys inside object are also required
ExperimentOverrideKeyExperimentOverrideKey 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.

Example

Creating a client with Forced Variations:

overrideStore := decision.NewMapExperimentOverridesStore()
client, err := optimizelyFactory.Client(
       client.WithExperimentOverrides(overrideStore),
   )

Removing a forced variation using Remove Forced Variation:

overrideKey := decision.ExperimentOverrideKey{ExperimentKey: "test_experiment", UserID: "test_user"}
overrideStore.RemoveVariation(overrideKey)

See also

Set Variation
Get Variation

Source files

The language/platform source files containing the implementation for Go is client.go.