HomeGuidesAPI Reference
Submit Documentation FeedbackJoin Developer CommunityOptimizely GitHubOptimizely NuGetLog In

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.

Parameter

Type

Description

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.

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.


Did this page help you?