Rich-text Reply

Is there a way to tell an experiment and or variation has run?

santhony7 02-23-17
Accepted Solution

Is there a way to tell an experiment and or variation has run?

[ Edited ]

I am trying to do this from the JS Settings as a global script. I would like to "watch" and know when any variation has run so I can log it in GA as an event. 

 

Something like...

 

watch(optimizely.get('state').getVariationMap(), function(experiment, variation ){

console.log(experiment.id);

console.log(variation.id);

})

 

Can't delete a question huh?

 

Anthony Smith
Highlighted
santhony7 02-23-17
 

Re: Is there a way to tell an experiment and or variation has run?

Although NOT using getVariationMap which stores variations that the user hasn't even seen yet.
Anthony Smith
JasonDahlin 02-24-17
 

Re: Is there a way to tell an experiment and or variation has run?

getVariationMap ought not be returning values for experiments that the user has not yet seen.
A user is allocated to a variation the first time they satisfy both the Audience and URL targeting.

Perhaps you mean to say that it is returning values for experiments that they have not yet seen *in this session*.
--Jason Dahlin
Analytics and Testing Guru Smiley Happy
Experimentation Hero
santhony7 02-27-17
 

Re: Is there a way to tell an experiment and or variation has run?

Yeah, sorry. It is persistent across sessions. In fact, it seems to be permanently in localStorage but I have a ticket in requesting that info.
Anthony Smith
JasonDahlin 02-27-17
 

Re: Is there a way to tell an experiment and or variation has run?

I'm using "Classic" but the approach would be the same...

I identify experiments that are running on the current page and place the experiment/variation assignment into a session persistent variable (I use a session cookie filled with JSON formatted data, but sessionStorage could also be used).

 

The code for this is placed into every page via my tag manager rather than as part of each experiment's javascript.

--Jason Dahlin
Analytics and Testing Guru Smiley Happy
Experimentation Hero
JasonDahlin 02-27-17
 

Re: Is there a way to tell an experiment and or variation has run?

Oh - This approach will not capture "triggered" experiments (which we don't use, so it doesn;t affect us but may affect yoU)

--Jason Dahlin
Analytics and Testing Guru Smiley Happy
Experimentation Hero
santhony7 02-27-17
 

Re: Is there a way to tell an experiment and or variation has run?

I think this should work fine for me but I do understand the limitation. Thanks!
Anthony Smith