Rich-text Reply

Should I put the same snippet javascript file on my own server?

xiaomu 07-03-14

Should I put the same snippet javascript file on my own server?

For example, a snippet file is http://cdn.optimizely.com/js/xyz.js

Should I download the xyz.js file, and then put the file on my own web server for web page to load, instead of the remote file in cdn?

Level 1

adzeds 07-03-14
 

Re: Should I put the same snippet javascript file on my own server?

Nope.

You will find that you constantly have to keep updating the file on your CDN every time you make a change.

There is no real performance issue with loading the snippet from the Optimizely CDN.
David Shaw
Level 11
Kathryn 07-23-14
 

Re: Should I put the same snippet javascript file on my own server?

Hi Xiaomu,

David has nailed it.

In general there is no real benefit to self-hosting our snippet and additionally you would need to download the snippet from Optimizely and update the self-hosted snippet file every time you change the settings for your project or make changes to an experiment.

If you've any concerns about snippet performance, feel free to let us know so we can put your mind at ease!

-Kathryn
Optimizely
brakon 3w ago
 

Re: Should I put the same snippet javascript file on my own server?

Well seems casper.com hosted the file themselves and it shaved off 1.7 seconds on page load time so seems there is value.

 

https://medium.com/caspertechteam/we-shaved-1-7-seconds-off-casper-com-by-self-hosting-optimizely-27...

Level 1

Re: Should I put the same snippet javascript file on my own server?

[ Edited ]

The 1.7s mentioned in the article includes changes other than just "self hosting".

They also did not mention if they used preconnect and prefetch tags to help move these handshakes earlier.

 

Isolating the "self hosted" pieces from the data they provided, it looks like ~400ms were saved by self hosting.

The other improvements resulted from other changes.

 

If 0.4s on first-page-hit is important to you (e.g., we cache ours for 15 minutes, so the user only fetches it once every 15 minutes - typically their very first page hit of their session), then self-hosting may be worthwhile to pursue. 

--Jason Dahlin
Analytics and Testing Guru Smiley Happy

Experimentation Hero