Skip to content

Instantly share code, notes, and snippets.

Variation variation = optimizely.activate("experiment_name", userId);
if (variation != null) {
if (variation.is("control")) {
// execute code for control
} else if (variation.is("variation")) {
// execute code for variation
}
} else {
// execute default code
}