Articles in The 'page load time' Tag


June 3 2011

Installing Site Speed tracking for Google Analytics

by MoreVisibility

A website page’s loading time is unfortunately something that is often over-looked. Have you ever been to a website that loads slowly? Almost everyone who has used the internet has at one point or another – and it’s a highly frustrating experience. We want pages to load, and we want them to load instantly!

Today, we’re going to help every website owner using Google Analytics to measure how fast (or, how slow) their webpages are loading by showing them how to configure their JavaScript tags to collect page loading speed data for their reports.

Ready? Here we go!

Step 1: Google Analytics Tracking Code

We have been very fortunate over the years to have a frequent stream of new readers to our Analytics & Site Intelligence blog (and our other blogs here at MoreVisibility), so we’re not going to assume anything – even if you’re a new reader and you use Google Analytics.

The Google Analytics Tracking Code (GATC) is the snippet of JavaScript that you will see on the pages of your website if you view the source code of any page. Most websites today are using one of two versions of the GATC: the asynchronous version (the “async” version), or the traditional version (the “ga.js” version).

Before you can install site speed tracking, you need to know which version of the GATC your site is using.

If your code looks similar to the following example, then your site is using the “async” GATC:

<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-XXXXXXX-X']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript';
ga.async = true; ga.src = ('https:' == document.location.protocol
? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(ga, s);
})();
</script>

If your code doesn’t look like the above example, but looks more like this second example, then your site is using the “ga.js” GATC:

<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol)
? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost +
"google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
var pageTracker = _gat._getTracker("UA-XXXXXXX-X");
pageTracker._trackPageview();
</script>

Knowing the type of GATC tracking code will allow you to follow along with your own site for the remainder of this blog post.

Now, for the small number of you who don’t see either of those two examples on your site, but rather you see something like this example:

<script src="http://www.google-analytics.com/urchin.js"
type="text/javascript"></script>
<script type="text/javascript">
_uacct = "UA-XXXXXXX-X";
urchinTracker();
</script>

then, you are about to receive some bad news. Your site is using the legacy GATC model, which is also known as the “urchin.js” GATC. Site speed reporting in Google Analytics does not support the “urchin.js” tracking code. You will need to update your website pages to the “async” GATC (recommended) or the traditional “ga.js” GATC in order to be able to collect and use site speed data in your reports.

Read about the benefits of the new “async” tracking code here.

Step 2: Installing the site speed command

To pull this off, you will need to install one additional line of JavaScript in a specific location of your GATC. However, make sure to copy the correct line of code for your GATC!

If you are using the “async” GATC, copy this line:

_gaq.push(['_trackPageLoadTime']);

If you are using the “ga.js” GATC, copy this line:

pageTracker._trackPageLoadTime();

Now that you have copied the correct site speed tracking line of JavaScript, paste it directly and immediately after the call to _trackPageview (this command appears in both GATC versions). I placed that instruction in bold because you want to make sure that you install this correctly (as with any JavaScript snippets).

Your “async” GATC should look like this after installation:

<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-XXXXXXX-X']);
_gaq.push(['_trackPageview']);
_gaq.push(['_trackPageLoadTime']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript';
ga.async = true; ga.src = ('https:' == document.location.protocol
? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(ga, s);
})();
</script>

Your “ga.js” GATC should look like this after installation:

<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol)
? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost +
"google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
var pageTracker = _gat._getTracker("UA-XXXXXXX-X");
pageTracker._trackPageview();
pageTracker._trackPageLoadTime();
</script>

Note: You don’t have to install site speed tracking on every page of your website – you can install it on select pages, or one page if you just want to test it out first. However, most developers use some type of include file or global template – so it maybe easier to apply this change on that include or template and update your GATC site-wide.

3. Things to know about site speed in Google Analytics

Now that you’re collecting site speed data, you will be able to see that data appear in the new version of Google Analytics (the data will not appear in the current / traditional version of Google Analytics). The report is in the Content section, and is the third link from the top.

Here is a list of things that you will need to know about the data that you will see:

– You will see two new metrics in the Site Speed report: Avg. Page Load Time and Page Load Sample.

Avg. Page Load Time is easy to understand: it’s the average amount of time (in seconds) that it takes for your pages to load.

Page Load Sample is the metric that you have to watch out for: this is the actual number of page views that Google Analytics is using at its sample to calculate the average page load time. You will definitely notice, as you collect site speed data, that Google Analytics isn’t using 100% of all page views to calculate your average page load time – this is perfectly normal.

Technical: using _trackPageLoadTime means that your website pages will send an extra “utm.gif” request to Google Analytics servers – which is separate from the standard request sent to track page views, and which is also perfectly normal.

– Visitors using older browsers that don’t support HTML5 or visitors using older browsers without the Google toolbar installed will not be able to be tracked for the site speed report (this is a small fraction of your visitors).

Have fun, glean lots of insights, and start optimizing slow-loading pages to be fast-loading pages! Also, leave us a comment to tell us how you will use Site Speed, or any tips that you would like to share.

May 7 2009

The Impact of Page Load Time on Search Engine Rankings

by Marjory Meechan

Page load time is an important factor in website optimization if only for the fact that if the pages of your site take too long to appear, users can become impatient, stop the load and go to another website. In fact, this is one of the big reasons I was so fond of Google right from the start — their nice clean homepage design had one big advantage over their competitors at the time — it came up quickly and gave me what I wanted right away without making me wait for pictures and other Flashy stuff to load. So we know that fast load time is good for users but what effect does load time have on search engine rankings? This is a question that comes up quite often. Matt Cutts of Google recently asked for topic suggestions for his latest video and this was the number one question.

So, can a delay in page load time affect your search engine rankings? The short answer is yes. Even if load time is not directly a factor in the search engine algorithms, slow load time could lead to a loss of rankings for a website — particularly a very large website. The reason is that in order for your pages to rank to their full potential in the search engine results, search engines need to have accurate information about them. Both the content on the page and the linking structure of the page are important factors in the search engine algorithm.

To illustrate further, consider this diagram to be a rough model of a site’s linking structure. If the page site-crawlrepresented by the node highlighted in yellow isn’t crawled by the search engine spider, all the other links that originate from it may not be found either, and that can affect not only the ranking of the top page but also the ranking of all the other pages beneath it, even if the search engine spiders can find those pages another way. This is because they won’t have the full information about how these pages are linked together.

 

If search engines do not see the full linking structure of a page because it takes too long to crawl the links on your site, linking structure information is not included in the index and the page will rank lower in the search results than it deserves. This is why including an xml sitemap on your site is not good enough to get individual pages indexed and ranked. Search engines have to see how the pages fit together as well.

Search engines cannot give you any credit for something they don’t see. The spiders have a limited amount of time to crawl a site and if page load time is too long, they are less likely to fully crawl your site and that can affect your rankings. Recently, Live.com’s Webmaster Blog did a special four-part series describing special optimization issues for large websites that featured some excellent advice for webmasters with tips for optimizing content, site structure and server configurations. Helping spiders get at your content as quickly and efficiently as possible is an important aspect of search engine optimization so load time should always be given a high priority in any large-scale website optimization project.

© 2022 MoreVisibility. All rights reserved.