Need for Speed: Why Your Website’s Speed Matters More Than Ever Before and How to Measure it

Uttam Deb
Bootcamp
Published in
9 min readApr 15, 2024

In the lightning-paced digital era, your website’s load time is like that first date impression — it’s got to be swift, sharp, and memorable. A slow-loading page is akin to arriving late for a date; it sets the tone for disappointment and lost interest. Make sure your site’s speed is love at first sight, not a reason to swipe out. Remember, your website’s UX depends on this!

Illustation by author using DALLE3
Illustration by author using DALLE-3

Your website isn’t just a storefront; it’s the red carpet to your brand’s universe. It’s where the spotlight hits, and within milliseconds, your audience decides if they’re in for the show or if they’ll scroll away to the next attraction. Users form opinions in the blink of an eye. If your website stutters, so does their perception of your brand. A slow load is like a stuttered greeting; it lacks confidence and loses attention. This generation, raised on the instant gratification of streaming services and social media feeds, won’t wait for the curtain to rise slowly. They want the main act, and they want it now.

Visit: www.uttamdeb.com for more similar guides!

In the digital age, your website is often the first point of contact between your business and potential customers. It’s where first impressions are formed and can be the deciding factor between a sale and a bounce. Understanding and optimizing your website’s load time is not just a technical concern; it’s a critical business strategy.

LET’S TALK: CONNECT WITH ME ON LINKEDIN

What is Website Load Time?

Website load time is the duration it takes for a webpage to fully display on a user’s screen after they have requested it. This includes all the text, images, scripts, and other elements that make up the page. It’s measured from the moment a user clicks a link or types in a URL to the point when the page is completely rendered.

READ THIS NEXT: How to Analyze Web and App Traffic Data with Google Analytics 4, BigQuery and Looker Studio

Factors That Influence Website Load Time

Several factors can affect how quickly a webpage loads, including:

  • Server Performance: How quickly the server processes requests and delivers data.
  • File Sizes: Larger files, such as high-resolution images and videos, take longer to load.
  • Code Efficiency: Clean, well-structured code can be processed faster by browsers.
  • Number of Requests: Each element on a page, like an image or a stylesheet, is a separate request to the server. More requests can mean slower load times.
  • User’s Device and Connection: A user’s internet speed and device capabilities can also impact load times.

Why Measuring Page Load Time is Essential for Your Business

User Experience: Users expect fast, responsive websites. A delay of even a few seconds can lead to frustration and a higher likelihood of users abandoning your site.

SEO Rankings: Search engines, like Google, use page load time as a ranking factor. Faster websites are more likely to appear higher in search results, leading to more organic traffic.

Conversion Rates: Every second counts when it comes to conversions. A one-second delay can lead to a 7% reduction in conversions, meaning slower load times can significantly impact your bottom line.

Customer Loyalty: Slow websites can damage your brand’s reputation and make customers less likely to return, affecting long-term revenue and growth.

Ideal Loading Times for Optimal Performance

The ideal loading time for a website is under 3 seconds. However, striving for even faster times can provide a competitive edge. Google’s Core Web Vitals suggests a Largest Contentful Paint (LCP) of 2.5 seconds or less for a good user experience.

The Cost of Slow Loading Times

If your website takes longer than the ideal time to load, it can result in:

  • Lost Sales: Potential customers may leave your site in favor of a competitor with faster load times.
  • Decreased Customer Satisfaction: A slow website can lead to poor user experience, reducing the likelihood of customers returning.
  • Lowered SEO Rankings: Slower load times can negatively impact your search engine rankings, leading to less visibility and traffic.

In conclusion, page load time is a vital aspect of your online presence that directly impacts user experience, SEO, conversion rates, and customer loyalty. By measuring and optimizing your website’s load time, you can ensure that your business remains competitive and poised for growth in the digital marketplace.

Measuring Your Website’s Page Load Time

Now that we have discussed why measuring page load time is important, let’s explore three methods to test and measure it effectively. Keep in mind that each new method will be significantly more complex than the previous method. This will give you an option to move on to the next method if you need something more comprehensive. Come on then, lord protector of data, let’s get started! 🤣

Method 1: Google PageSpeed Insights interface

Google PageSpeed Insights is a user-friendly tool that provides a snapshot of your website’s performance. Simply enter your website’s URL at Google PageSpeed Insights to receive a report. This report includes a variety of metrics that assess different aspects of your site’s load time:

A sample test using Google PageSpeed Insights

The PageSpeed Insights report also breaks down page performance into four primary categories: Performance, Accessibility, Best Practices, and SEO, providing a comprehensive view of your website’s health.

However, this method offers a static view and doesn’t track changes over time, which is where the API comes into play.

Method 2: Google’s PageSpeed Insights API

For dynamic and continuous measurement, Google’s PageSpeed Insights API can be integrated with Google AppScript to periodically check and record your website’s load time. Here’s an enhanced script that not only measures but also explains the process:

function PageSpeedInsightsAPI() {
// List of URLs to test
var urls = [
'YOUR_PAGE_URL',
'YOUR_PAGE_URL',
'YOUR_PAGE_URL',
];

// Access the active sheet
var sheet = SpreadsheetApp.getActiveSheet();
var date = new Date();

// Retrieve or initialize the URL index
var scriptProperties = PropertiesService.getScriptProperties();
var urlIndex = scriptProperties.getProperty('URL_INDEX');
urlIndex = (urlIndex === null) ? 0 : parseInt(urlIndex);

// Fetch the PageSpeed data for the current URL
var url = urls[urlIndex];
var response = UrlFetchApp.fetch('https://www.googleapis.com/pagespeedonline/v5/runPagespeed?url=' + url);
var json = JSON.parse(response.getContentText());

// Extract performance score and load time
var performance = json.lighthouseResult.categories.performance.score * 100;
var loadTime = json.lighthouseResult.audits['interactive'].numericValue / 1000;

// Append the data to the sheet
sheet.appendRow([date, url, performance, loadTime]);

// Update the URL index for the next run
urlIndex = (urlIndex + 1) % urls.length;
scriptProperties.setProperty('URL_INDEX', urlIndex.toString());
}
// Set a time-driven trigger to run the function periodically

This script will test multiple URLs, store the performance score, and load time in a Google Sheet, and can be set to run at intervals of your choice, providing a historical view of your website’s performance. Just go ahead and set a time-driven trigger to run the test on regular intervals.

IF YOU LIKE WHAT YOU READ, CONSIDER FOLLOWING ME ON MEDIUM! 🥳

Method 3: Measuring Page Load Time with Google Tag Manager and GA4

Google Tag Manager (GTM) paired with Google Analytics 4 (GA4) provides a powerful way to measure and store the page load times experienced by your users. If your website uses Google Tag Manager and Google Analytics 4, you can easily add custom JavaScript code using a google tag to every page of your website which will in turn will store the time taken for the page to load on user’s end. Page Load Time event is not included by default in the lastest version of Google Analytics. But fear not, I am here to save your day!

Here’s how to set it up step by step:

Step 1: Create a Custom JavaScript Variable in GTM

  1. Go to Google Tag Manager and select your account.
  2. Navigate to Variables and click New to create a new variable.
  3. Name the variable “Custom — Page Load Time”.
  4. Choose Variable Type as Custom JavaScript.
  5. Copy and paste the following JavaScript code into the variable configuration:
function() {
if (window.performance && window.performance.getEntriesByType) {
var entries = window.performance.getEntriesByType("navigation");
if (entries.length > 0) {
var navTiming = entries[0];
var pageLoadTime = navTiming.loadEventEnd - navTiming.startTime;
return Math.round(((pageLoadTime / 1000) + Number.EPSILON) * 100) / 100;
}
}
return 0; // Return 0 if the performance timing isn't supported
}

6. Save the variable.

How to set the Page Load Time variable

Step 2: Set Up a Trigger for Page Load

  1. In GTM, go to Triggers and click New.
  2. Name the trigger “Window Loaded”.
  3. Select Trigger Type as Window Loaded.
  4. Configure the trigger to fire on All Window Loaded Events or specify exceptions if necessary.
  5. Save the trigger.

Step 3: Create a GA4 Event Tag

  1. Still in GTM, navigate to Tags and click New.
  2. Name the tag “GA4 — Page Load Time”.
  3. For Tag Configuration, choose Google Analytics: GA4 Event.
  4. Enter your Measurement ID from GA4.
  5. Under Event Parameters, add “loading_time_sec” and set its value to the variable “Custom — Page Load Time” created earlier.
  6. Add any additional parameters you wish to track with this event.
  7. Select the “Page View — Window Loaded” trigger for this tag.
  8. Save the tag.

Step 4: Testing time!

  1. Use the Preview mode in GTM to test the tag and ensure it fires correctly on page load.
  2. Check the Real-Time report in GA4 to see if the event is being recorded.

Step 5: Add the Custom Metric to GA4

  1. In GA4, go to Admin and under the Property column, click Custom Definitions.
  2. Click Create custom metrics.
  3. Name the metric “Page Load Time”.
  4. Set the Event parameter as “loading_time_sec”.
  5. Choose Seconds as the unit of measurement.
  6. Save the custom metric.

Now, you’ve successfully set up a method to measure and track the page load time of your website using GTM and GA4. This data will be invaluable for understanding and improving your site’s performance.

The Superior method

Let’s jazz up this discussion with a bit of flair and dive into why using Google Tag Manager (GTM) with Google Analytics 4 (GA4) is like having a VIP backstage pass to the ‘performance concert’ of your website.

Setting the Stage for Success

Imagine setting up a sleek dashboard giving you real-time stats on your website’s speed. With GTM and GA4, you can track the page loading time across various development phases of your site. It’s like having a time machine that shows you how your site’s speed has rocked through the ages.

Avoiding the Data Traffic Jam

Now, let’s talk about the elephant in the server room: data overload. Google Sheets is fantastic, but it can start to crawl like Dhaka traffic during rush hour when it’s jam-packed with data. Especially if you’ve got more website paths than a maze in a cornfield! But with this method, you’re automating the process, tracking every encore and stage dive your pages perform without breaking a sweat.

Hitting the High Notes of Accuracy

When it comes to accuracy, client-side events are met with increased precision than the methods before it. It captures the moment your real-world audience experiences each stage of page loading, unlike Google’s simulated soundcheck. Sure, it may not be the most accurate method, but it is better than the other methods we discussed today.

The Deep Dive Solo

Now, for the fans of deep cuts, GA4’s event-level data is like an exclusive box set of insights. You can analyze different related circumstances the user might have faced when they were loading a page. Maybe an error event has triggered which has rendered the user’s page loading capability to become slower? Perhaps, a bundled product sometimes slows things down? Maybe the mystery lies within the previous activities undertaken by the user before loading a page? What if a particular type of device is facing loading issues? This is your all-access pass to this level of analysis.

And for the grand finale, let’s not forget: measuring page load time is just the opening act in the grand festival of overall page performance. It’s about setting the stage for a seamless user experience, where every page hits the right note, every time.

So, there you have it, folks — the headliner method that keeps your website’s performance rocking around the clock! Let me know if this guide has helped you or if you have any questions or suggestions!

--

--