Rich-text Reply

Trouble with jquery caching

jb 07-17-15

Trouble with jquery caching

I think it's from jquery... it's not regular browser caching.


I have an experiment with four variations. Some of them have changes to the top main nav bar. Some do not. However all variations will show the modified nav bar, whichever was the last one I loaded.


I am checking the versions in another browser by forcing the variation in the URL like this:


This works well except for the caching issue. As soon as I load a variation where I have modified something, all other variations also load that piece of the page with the modified code, even when those variations should still be using the original version of that piece of code.


I hope that makes sense, if anyone has any tips I'd love to hear them! Maybe there's a flag I can add in the code Editor or something, to force jquery to reset completely for every variation?

Level 1

JDahlinANF 07-17-15

Re: Trouble with jquery caching

Very odd - definitely not default behavior.


Right now, on our site we have an A/B/C experiment where variations B and C enable a widget with two different presentations on a specific page.  Variation A does absolutely nothing on the page.  I verified I am in variation C.


When I add the URL parameter &optimizely_xNNNNN=0, the page loads without the feature enabled.

When I add the URL parameter &optimizely_xNNNNN=1, the page loads with the feature enabled but with the presentation appropriate to that variation

When I remove the URL parameter, the page loads with the feature enabled with the presentation appropriate for variation C.


Re: Trouble with jquery caching

Hi @jb,


Good question and this does seem a bit odd.  First, let me clarify a couple things about Optimizely's expected behavior to set a baseline:

  1. As @JDahlinANF pointed out, the value after the equal sign in the Force Variation parameter needs to be the index of the variation (in the left-to-right order of how your variations physically appear in the editor), not the variation ID.  For example, your original will be the left-most variation and hence use an index of 0, variation #1 will be 1, and so on.
  2. If your experiment is live and running, the Force Variation parameter will not only bypass targeting to show that variation on the page, it will also also update your optimizelyBuckets cookie and permanently target you to that variation.  That is, if you remove the parameter, you will always see the last variation you forced, as that is what your natural bucketing now reflects.

Another thing to keep in mind is by default Optimizely evaluates each experiment independently of any other, even for multiple experiments running on the same page at the same time.  If you qualify for many such experiments, you will see all of them.  Thus, you may wish to use the Experiments tab of Preview Mode to verify what other experiments may be running on the page to see if there some overlap.


If these details do not explain your issue, please feel free to send your experiment details to our Support team for a further look.  Thanks!

Harrison Krat
Solutions Architect | Optimizely, Inc.
JDahlinANF 07-20-15

Re: Trouble with jquery caching

@Harrison_Krat How in the world did I not notice point #2 before?!!? 


We've been sharing code that users have to run that pushes "bucketVisitor" commands to alter the cookie.  This will be much easier for sharing with our business users.

Re: Trouble with jquery caching

@JDahlinANF Glad we were able to point out something helpful!  While this point is documented on our KB, it's actually something very few of our customers know, so don't feel bad!

Harrison Krat
Solutions Architect | Optimizely, Inc.