Skip to content

Preserving good Google page rank metrics

Many have discovered that caching isn't a silver bullet. Varnish and Redis help scale, but unless care is taken, Google page ranking metrics will suffer.

If server response times are bad it will hurt your pagespeed score for sure. It will degrade the "Largest Contentful Paint" a lot.

Otherwise, most of the other metrics are frontend related, not the server response time, so Varnish doesn't have an impact.

Of course, if your resources are loading slowly, that will impact the rest of the scores, too, but frontend performance is mostly:

Minimizing the amount of loaded resources

This means

  • Lazy loading as many images that are not in view.
  • Only loading JS libraries that are needed, and most importantly when they are needed.

Keeping the layout stable, and rendering it as soon as possible

This can be accomplished by

  • Not using JavaScript to change the display of items on initial pageload.
    Instead, image and video sizes should be predefined. Images should be optimized and too large images should be avoided completely.
  • Not rendering elements visible, and then makeing them invisible after JS has initialized (or the other way around).
    Instead, pre-set the size of containers for things like cookie banners, news banners etc.

The most harmful JS libraries tend to be for chats, tracking, popups, cookie consent, search, etc.
These should be loaded using a facade.

For example, a chat Library should be loaded only when scrolled down X number of pixels, or on mouse-movement.
Search autocomplete library should only be loaded when the search field is clicked or focused.
Only load video thumbnails initially, and load the video embed/api only when the video/image is clicked.

Custom Fonts

In most cases, custom fonts should not be preloaded because doing so blocks the first paint in the browser.
The downside can be layout shifts, which can be fixed by setting the right system fallback fonts and line-heights (reserve space). More information can be found in the custom fonts FAQ item.

GTM / Analytics

Finally, the hardest thing to optimize is GTM/Analytics.
Hopefully something like https://partytown.builder.io/ will resolve this in the future.