shdu12
shdu12

Reputation: 113

Optimizely not getting activated for Java SDK code

I'm trying to use the below code from the Optimizely docs :

Map<String, Object> attributes = new HashMap<>();
attributes.put("device", "iPhone");
attributes.put("lifetime", 24738388);
attributes.put("is_logged_in", true);

Boolean enabled = optimizelyClient.isFeatureEnabled("new_feature", "user123", attributes);

In the optimizely api , I have the experiment setup as "new_feature" with variation key as "var1" and user attributes for audience targeting with those above attributes. I have whitelisted the user123. But I don't think my experiment is getting activated or receiving any traffic. Am I missing anything here? Any hints are helpful?

Upvotes: 2

Views: 425

Answers (1)

Josh Wang
Josh Wang

Reputation: 531

isFeaturerEnabled is the API for feature flags.

You can set up experiments as standalone objects or as experiments on feature flags.

If you only want to activate a user for a standalone experiment, you will use activate(experimentKey, userID).

If you want to activate a user for an experiment on a feature flag, you can use isFeatureEnabled like you are now.

More in depth information on activate API here

Upvotes: 0

Related Questions