- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
How to get the current variation the user should see with API in a single page app

How to get the current variation the user should see with API in a single page app
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report
Hello,
I am exploring the possibility of adding optimizely to our angular single page app. What I am trying to achieve is the following:
- Be able to run a test after a state change. Currently, I am activating the test using the manual activation code.
- Get the information (from Optimizely) about which variation the current visitor should see.
- Show the variation to the user.
Currently, I am having trouble finding which variation the current visitor should see. I want to use Optimizely's random allocation of traffic to know which variation I should show and then change the page accordingly.
The app uses:
- AngularJS 1.5
- UI-router
Solved! Go to Solution.

Re: How to get the current variation the user should see with API in a single page app
[ Edited ]- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report
Hi,
have you tried accessing:
optimizely.variationMap
via JavaScript?
"This is a hash table whose keys are the experiment ids of experiments running for the visitor (including inactive experiments for which the user has been bucketed), and whose values are the variation indexes for those experiments." ( see: http://developers.optimizely.com/javascript/reference/ )
Kind regards
Michael
Michael



