The Case for Limiting Analytics and Tracking Scripts

Boosting Page Speed by taking a look at the exces of analytics and tracking scripts on your page

Arjen Karel Core Web Vitals Consultant
Arjen Karel

The Case for Limiting Analytics and Tracking Scripts

Hey, fellow speed seekers! As a web enthousiast you must know that every second of delay can mean the difference between engagement and abandonment. Yet, one often overlooked culprit hinders speed: an overreliance on analytics and tracking scripts. In this article, I'll delve into the reasons why limiting the use of analytics and tracking scripts can significantly enhance page speed and, consequently, user satisfaction!

The Need for Analytics and Tracking Scripts:

Analytics and tracking scripts serve a vital role in understanding user behavior, measuring marketing effectiveness, and making data-driven decisions.  They provide valuable data that can help improve the user experience, identify bottlenecks in the conversion process, and optimize marketing strategies. Without data collection, website owners would be left in the dark, guessing what works and what doesn't. Popular tools are Google Analytics, Facebook Pixel and CloudFlare analytics. However, their widespread use can inadvertently contribute to slower page loading times.

analytics collection

Fact: In about 90% of all audits I will find unused tracking scripts. Usually these scripts are injected late through a tag manager or other third party script.

Understanding Analytics and Tracking Scripts

Analytics and tracking scripts are pieces of code embedded within websites to collect and analyze user data. One of the most widely used tools is Google Analytics, which provides website owners with valuable insights into user behavior, traffic sources, and conversion rates. These scripts gather information such as the number of visitors, pages viewed, time spent on each page, and even specific actions taken by users, such as clicking on a button or submitting a form.

Impact on Page Speed:

Now here is where it get's interesting.  Every extra byte that you add to a page will, in one way or another, have a negative impact on pagespeed. It is crucial to strike a balance between collecting enough data and user experience. Excessive data collection can lead to slow page speeds and a negative perception of the website by users. Tracking scripts will impact the Core Web Vitals in the following ways:

Increased Number of Requests:

Analytics and tracking scripts typically involve external requests to third-party servers. Each script added to a webpage represents an additional HTTP request, leading to increased load times. Even if the tracking scripts are loaded asynchronously or deferred they will still compete for network and CPU resources! This is particularly true on pages with numerous tracking elements and can have an impact on the Largest Contentful Paint.

Dependency on External Servers:

Third-party scripts often depend on external servers for data retrieval. If these servers experience downtime or latency, it directly affects the loading speed of your website in unforeseen ways. Limiting the number of dependencies reduces the risk of slowdowns. 

Blocking Render:

Many tracking scripts load asynchronously, allowing other page elements to load simultaneously. However, some scripts may be render-blocking, meaning the browser must wait for them to load before rendering the page. This delay can result in a slower perceived page speed because it delays both the First Contentful Paint and the Largest Contentful Paint.

Extra Cookies

Each tracking script can place its own cookies for tracking purposes, adding to the total cookie load on your website. While individual cookies are small, their collective impact on the Core Web Vitals can be significant because the information of each cookie will get send with every request adding to the request overhead. Adding extra overhead to network requests can impact the Time to First Byte on subsequent pageviews and on static resources.

Continuous main thread work

Many tracking scripts will keep tracking user behavior on the page well after the page has finished loading. Tools like Google analytics can be configured to track every click on your page. Tracking those clicks will in many cases interfere with the browser ability to quickly update the page on interaction. This can (and will) lead to a decline in Interaction to Next Paint (INP)metrics

Strategies for Smarter Tracking:

Now that you understand how tracking scripts can affect the Core Web Vitals you will see, it is important to evaluate the necessity of each tracking script and limit their usage when possible based on these 4 principles:

Prioritize essential data: Identify the core metrics you absolutely need to track and eliminate those offering redundant or insignificant information.

Consolidate scripts: Opt for multi-purpose tracking solutions that combine functionalities instead of adding individual scripts for each task.

Leverage asynchronous loading: Ensure scripts load without blocking core page content, minimizing perceived delays. For less important tracking scripts even consider injecting these scripts after page load!

Utilize tag managers efficiently: Control scripts triggers and tag sequencing effectively to streamline their impact on page speed.

[ include]sidebar.html[/include]

I help teams pass the Core Web Vitals:

lighthouse 100 score

A slow website is likely to miss out on conversions and revenue. Nearly half of internet searchers don't wait three seconds for a page to load before going to another site. Ask yourself: "Is my site fast enough to convert visitors into customers?"

The Case for Limiting Analytics and Tracking ScriptsCore Web Vitals The Case for Limiting Analytics and Tracking Scripts