Google Page Speed and Clerk.js

Google Page Speed and Clerk.js Why Clerk.js showing up in Google Page Speed is a good thing.

If you use Google Page Speed Insights to analyse your site’s performance (as you should - or at least an equivalent tool) you will see Clerk.js listed under Leverage browser caching. This article will tell you why this is a good thing.

The purpose of Clerk.js is to make it super simple to insert results from Clerk.io into any website. Clerk.js contains a bunch of features to handle tracking and UI components such as search-as-you-type, sliders, exit-intent popups.

When we add new UI features or make improvements to existing ones, they are included in Clerk.js and must be downloaded by the end user in order to use them.

Having a cache expiry of 60 minutes means that when we release new features they will be available to everyone within a maximum of 60 minutes. The longer the cache time the longer before everyone has access to the newest features.

The important thing is that end users only have to download Clerk.js once when new features are available!

The 60 minute cache expiry just means that the end users browser will check in with Clerk.io every 60 minutes. If no changes have been made to Clerk.js nothing will be downloaded. This check-in request is both super fast and cheap since data will only be downloaded if a new version of Clerk.js is available.

The cache expiry time of 60 minutes is thus a tradeoff between minimising web requests and seeping new features and improvements. Remember that most sessions are way lower than 60 minutes and thus the request will only be made once per session or visit.

As you can see in the screenshot this is a normal practice that (as well as Clerk.io) is used by Google, Google Analytics, Facebook, New Relic, Trustpilot and many others.