Rich-text Reply

Is it safe to programmatically delete the localStorage entry for variation_map?

santhony7 02-24-17

Is it safe to programmatically delete the localStorage entry for variation_map?

I need to make the variationMap session based and not persistant. 

Anthony Smith
JasonDahlin 02-24-17
 

Re: Is it safe to programmatically delete the localStorage entry for variation_map?

[ Edited ]

localStorage is not required for Optimizely to function nor is it required to persist variations assignments (in most cases).

 

As a result - deleting it will not cause your users to be re-allocated to a new variation just by deleting it.

 

To accomplish this, you would need to look for a session cookie in your project JavaScript.  If the cookie, exists, it is a user still in their current session, if it does not exist then it is a "first page hit" so you will attempt to remove the user from this (all?) experiments, then set the session cookie.  Since this runs before the experiments run, this should result in your user being removed from the experiment (or all).

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

Re: Is it safe to programmatically delete the localStorage entry for variation_map?

Thanks for the reply. This is good info to know. What I was hoping would happen would that deleting the entry in localStorage would make it "reset" the experiments/variations that are in storage so that ONLY experiments/variations that the user has seen in the session would be represented. However, what I noticed was that, upon delete and refresh, the localStorage is updated again with ALL seen variations throughout time. So it must be tied to the user's cookie. Bummer. What I am trying to do is to get a collection of experiments/variations seen per session without adding JS to each experiments/variation.
Anthony Smith
JasonDahlin 02-27-17
 

Re: Is it safe to programmatically delete the localStorage entry for variation_map?

This conversation is strikingly simnilar to this one - perhaps the solution proposed there would assist,

https://community.optimizely.com/t5/Developers/Is-there-a-way-to-tell-an-experiment-and-or-variation...

 

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

Re: Is it safe to programmatically delete the localStorage entry for variation_map?

Ha. They are both mine. :-)
Anthony Smith