Max Rozen

Improve your SEO by delaying your marketing scripts

October 23, 2019 • ☕️ 1 min read


The short of it is: adding snippets to your site from common marketing tools like Intercom, Segment, and FullStory slows down your customers’ ability to use your site.

Slow sites get less consideration from Google, as customers are generally more likely to bounce from slow sites.

We can measure the impact of deferring the loading of these scripts using a metric called Time to Interactive (TTI). TTI is one of the core metrics in Google’s Lighthouse tool.

The fix

Add the following code to wherever you load your marketing scripts. Then move your marketing scripts where it says //insert marketing snippets here.

  () =>
    setTimeout(() => {
      //insert marketing snippets here
    }, 1000),
  { once: true }

How it works

By moving your snippets into the setTimeout callback, you delay loading your marketing scripts until after your entire website has loaded. This means your customers see your content faster, and Google gives your site more SEO consideration.

When your customer starts scrolling down your page, after a second your marketing scripts will start loading.

If this post helped you, I'd really appreciate a share on Twitter.

Max Rozen

Thoughts on the Web.