How to reduce JS snippet size?
In Settings/Implementation page the reported snippet size is 67.23KB, which unzipped is around 200KB. We don't have any experiments running currently, one enabled integration (GA Universal) and we checked option to exclude draft and paused experiments. We do include trimmed jQuery 1.11.3.
On mobile devices it takes a while to download and parse all this JS code. Is there any way to further reduce the snippet size? It's just a bit smaller than React framework (about 250KB minified) and larger than Angular 1.x (about 150KB minified)...
In addition to the steps mentioned above, you can reduce snippet size by checking the box "Exclude draft and paused experiments" in the privacy tab under settings. What this feature does, is excludes experiments that are in draft and paused states from being loaded into the snippet. This would prevent some QA functions from working on draft and paused experiments but it is a feature you can turn on and off at will.
The best solution is the simplest.
It still surprises me that the smallest possible version of Optimizely with trimmed jQuery is about 200KB (67KB gzipped) - which is more than size of most JS frameworks... Optimizely without jQuery is still pretty big - almost 110KB (38KB gzipped). We'll probably investigate loading it asynchronously, but I suspect that once we add server-side rendering, flashing will be even more visible and unfortunately unacceptable.
Has anyone tried replacing trimmed jQuery with e.g. zepto (9.6KB gzipped)? Is Optimizely using jQuery in its own code, or is it only used by experiments?
You are correct @Jannis
Optimizely X does not require jQuery like Optimizely Classic.
Something else to note is paused and draft experiments are not saved in the Optimizely X snippet like they are in Optimizely Classic.
@Breana_Eads, what is the smallest snippet size one can achieve with OptimizelyX? No jQuery sounds promising. What else can be done to reduce the size? I've used Classic but haven't yet tried X. Thanks