Rich-text Reply

Experiment and variation names via API

Ling 07-20-16
Accepted Solution

Experiment and variation names via API

Hello,

 

I am trying to extract the variation names active for the current user. In the Experiment dashboard, I have assigned a custom name to both the experiment itself and the variations. However, when accessing these via the data object, it returns generic names like "Exp 12345678" or "Var 987654321".

 

Is there any way to retrieve the actual names assigned to these entities? Is it possible that this is happening because I'm using the trial version?

 

Example:

Object.keys(window.optimizely.data.experiments).map(function(experimentId) {
  return window.optimizely.data.experiments[experimentId]['name'];
});

// returns ["Exp 6577150529", "Exp 6585200497"]
Level 1

JasonDahlin 07-20-16
 

Re: Experiment and variation names via API

If your settings are set to obfuscate your experiment names, you won't be able to get them from the DOM.

 

Here is a javascript bookmarklet I developed that you can use that returns the experiment names and variations.

(be warned... this message board turns certain characters into smiley faces... nothign I can do about that so you may need to reverse engineer a couple pieces).

javascript:(function()%7Bvar%20pgExp%20%3D%20%22%22%3Btry%7B%24(optimizely.activeExperiments).each(function(i%2Cd)%7Bvar%20experiment%20%3D%20optimizely.allExperiments%5Bd%5D.name%3Bvar%20variation%20%3D%20optimizely.variationNamesMap%5Bd%5D%3BpgExp%20%2B%3D%20experiment%20%2B%20'%20-%20'%20%2B%20variation%20%2B%20'%5Cn'%20%3B%7D)%3B%7Dcatch(e)%7B%3B%7Dalert(pgExp)%7D)()
--Jason Dahlin
Analytics and Testing Guru Smiley Happy
Experimentation Hero
Ling 07-21-16
 

Re: Experiment and variation names via API

Thanks, going to project settings and deselecting that one solved the issue.
Level 1