Rich-text Reply

Questions about snippet size

GidonBelmaker 09-11-14

Questions about snippet size

I've read that the snippet should not be larger than 60KB.  However, in my project, even with no active experiements My snippet size is 47 KB. It looks like I will max out on it really fast. 


My website has a large volume of content and I plan to create many experiements daily. Should I be concerned about this? What effect does having a snippet larger than 60 KB has? 



AdamA 09-11-14

Re: Questions about snippet size

Hi @GidonBelmaker , it's certainly a best practice to keep your snippet size down when possible, but 60KB is not a hard limit. Ultimately, you'll want to look at the impact of Optimizely on your site's performance if your snippet is above 60KB or so. Pageload time matters more than the actual size of the snippet, because that's what your visitors will experience.


When you're thinking about running multiple experiments, my advice would be:

  • Keep the amount of jQuery in the Edit Code box as low as possible. If you're planning to test extensive changes, you may want to use a redirect test instead of making the changes in the Editor.
  • Archive any experiments that aren't actively in use. 
  • Consider whether you can use substring targeting, multivariate testsor multi-page tests instead of running multiple experiments at one time. 


If you keep these principles and techniques in mind, you should be able to run multiple experiments without running up your snippet size too significantly, but again, don't view 60kb as a hard limit.


Please let me know if you have other concerns, and how your snippet size looks once you start creating more experiments!




Amanda 09-15-14

Re: Questions about snippet size

Hi Gidon,


As AdamA metioned, as long as you are archiving experiments that you are no longer using, you should not be in any danger.


If you are already loading jQuery natively on your site, then you can actually use this jQuery instead of loading it through the Optimizely snippet. This is one trick significantly reduce the size of the snippet. You'll just need to make sure that your jQuery javascript is loaded above Optimizely. Check out our support article here for additional information.