Rich-text Reply

GEt variation ID from API

JaimeNeto85 12-12-14

GEt variation ID from API

Hi, I'm trying receive the Variation ID from your API but I found nothing about this in your documentation.


Other thing: can I get the variation ID before the js to be loaded by browser?


I'm build one code to do the optimizely test variation interacting with backend too, but to do this, I need receive the variation ID to say for my code when change somethings on backend too.

Could you help me?
MartijnSch 12-12-14

Re: GEt variation ID from API

Hi, am I wrong or isn't window['optimizely'].data.variations the data you're looking for from the Javascript API?
nolanmargo 12-15-14

Re: GEt variation ID from API

[ Edited ]

This should provide you with the appropriate documentation for future API questions:

Aicke 02-05-16

Re: GEt variation ID from API

Get currently active variations on the page:


Array.forEach(optimizely.activeExperiments, function(experimentId) { console.log(optimizely.variationNamesMap[experimentId]); });
Everything is hard, before it is easy.
Level 2