Google Analytics Code is Slowing Down My Site

Fast page load times are vital for websites. Users have a notoriously short attention span, and visitors will leave if a site takes more than a few seconds to load.

When Google Analytics was first released in 2005, slowness caused by the Google Analytics Tracking Code (GATC) was common. A few years later, the asynchronous version of the tracking code was released – this made sure the browser didn’t wait for the code to finish loading to continue rendering elements referenced on the page. This change eliminated most slowness issues.

Fast forward to today: GATC does a lot more than it used to. It handles:

  • Pageviews
  • Events
  • Ecommerce Transactions
  • User Timings
  • Social Interactions
  • Exceptions
  • Screenviews

…and integrates with other Google services like DoubleClick and Google Tag Manager.

With all this overhead, it’s realistic to ask:

Does Google Analytics Code Slow Down My Site?

The quick answer is “probably not” but you can verify this with a few minutes of investigation.

First, open your browser console (press F12 on your keyboard), click the Network tab, and reload the page. Click the “Time” column to sort the content items by the time they take to load, and look for in the domain column.

You should see a low time (100 ms or less) for everything from the domain. If you see higher times or if you still have slow page loads, you’ll need to investigate further.

There are two components to consider: the amount of time it takes to download external files (connection speed) and the amount of time it takes for your browser to render JavaScript (processor speed).

Here are some troubleshooting ideas:

  • Click the “Console” tab of your browser console and reload the page: look for errors
  • Verify you’re using the current version of the tracking code snippet
  • Move the GATC snippet to a different location in the page, like the header or footer
  • Identify slow-loading content items with Google PageSpeed Insights or the Lighthouse chrome extension
  • Individually disable third-party scripts and reload the page: check Timings

Hidden Visitors

Something else to consider: if the GATC doesn’t load before a visitor clicks away from the page, the page data (or visitor) won’t show up in Google Analytics.

This also happens when a visitor prevents the GATC from running, or blocks the tracking request from being sent. Popular browser plugins like AdBlock and NoScript make this easy to do.

One solution to this problem is to use Google Analytics AND web analytics software – the latter is able to detect visitors who block GATC requests. Learn more here:

Web Analytics Software for Google Analytics