SpeedCurve's customers are focused on improving the performance of their websites. Many use our LUX service to do real user monitoring. This requires adding the lux.js script to their pages. But, our customers know that third party scripts are a major culprit in making websites slower. So we often get asked if customers can self-host lux.js in an effort to avoid any slowdown.
In this case, lux.js must be served by SpeedCurve. But don't worry! If you load lux.js per our instructions, it won't slowdown your pages because:
- Unlike many analytics packages, lux.js is cached for a long time (one week), so in most cases your users won't have to re-download the script.
- lux.js is loaded asynchronously, so it won't block your page from rendering and is given a lower priority for downloading and executing.
- The code to load lux.js uses the defer attribute which makes it even more performant than the more typical async attribute.
So you don't need to worry about lux.js slowing down your pages.
There are additional reasons why lux.js must be loaded from SpeedCurve. We have a long cache time for lux.js because we use an advanced technique to do updates when a critical change occurs. This mechanism only works if lux.js is hosted by SpeedCurve. If not, it's likely that LUX would stop working and data would be incorrect or lost. In addition, the contents of lux.js are generated dynamically based on your SpeedCurve settings. If lux.js isn't served from SpeedCurve then the contents of lux.js might get out-of-sync with your account settings and stop working.