Created
September 18, 2017 16:55
-
-
Save isquick82/c1db343cd07c7e3dfc1aa36870e41697 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from optimizely import optimizely | |
# Initialize an Optimizely client | |
optimizely_client = optimizely.Optimizely(datafile) | |
# Activate user in an experiment | |
variation = optimizely_client.activate('my_experiment', user_id) | |
if variation == 'control': | |
# Execute code for variation A | |
elif variation == 'treatment': | |
# Execute code for variation B | |
else: | |
# Execute default code | |
# Track conversion event | |
optimizely_client.track('my_conversion', user_id) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment