All posts tagged ‘Google Analytics’

File Under: JavaScript, Web Basics

Speed Up Your Site With Google Analytics New Page Speed Tools

Google has announced a new tool for Google Analytics — the Site Speed report. The new speed report measures page load times across your website, offering an easy way to see which pages could use optimization and which are already fast.

While the new page speed tool is available to all Google Analytics users, you’ll need to opt-in and update the Analytics JavaScript snippet in your webpages. To update the code on your site, see the Google Analytics help page.

Chances are — if you’re a good Webmonkey — you’re already testing your page load times with YSlow, Google’s Page Speed site, Web Page Test and other optimization tools. What makes Google Analytic’s offering a bit different is that abstract numbers, like how long it takes to load a page, are correlated against other numbers, like the percentage of exits from that page. It’s one thing to know that your online store landing page is loading a bit slowly, but it’s even more useful to know that the slow load time is actually driving customers away.

Once the new Analytics code is running on your website, the Site Speed report will rank your pages from those with the highest latency to those with the lowest. Site Speed will also list all of the following information:

  • Avg Page Load Time — the average amount of time (in seconds) it takes that page to load, from initiation of the pageview (e.g. click on a page link) to load completion in the browser.
  • Pageviews — The actual number of times the page was viewed for the selected date range.
  • Page Load Sample — The actual number of pageviews that were sampled to calculate the average page load time.
  • Bounce Rate — As for Pages report, the percentage of views to this page in which this page was the only one viewed for the session.
  • % Exit — As for the Pages report, the percentage of views to this page in which this page was the last page in the session.

Keep in mind that you’ll need at least several hundred pageviews before this information really begins to tell a useful story about your site. For smaller websites that may mean waiting a few days before you get a true picture of your load times.

As I mentioned in the write-up about the new Opera Dragonfly, there’s really no such thing as too many developer tools. The same applies to speed testing tools, and Google Analytic’s new offering is indeed handy.

For those that eschew Google in favor of self-hosted analytics — like the popular Mint or good old AWStats — there are self-hosted page speed trackers available as well, such as Yahoo’s Boomerang suite (BSD license).

See Also:

File Under: Backend, Web Services

New Asynchronous Script Stops Google Analytics From Slowing Down Your Site

Google Analytics is one of the more popular ways to keep track of your site’s visitors. With the ability to track, compare and compile all sorts of statistics about who’s visiting your site, Google Analytics is hard to beat.

Unfortunately, all that statistical goodness has a price — the JavaScript Google Analytics uses to track your visitors can slow down your page load times. Traditionally, the delayed page load problem was solved by placing the Google Analytics JavaScript code at the bottom of your pages (just before the closing </body> tag).

However, Google is now offering a second possible solution — a new Google Analytics script that loads asynchronously.

The asynchronous script means browsers will load the ga.js script file separately from the rest of your page, minimizing the impact on page rendering.

The net result is that you can move your Analytics code back up to the head tags of your pages and it won’t slow down your pages. Or rather it will, but it won’t be noticeable to users. In our testing, the new script loaded in between 80ms-120ms, whereas the old script loaded in 40ms-60ms.

The new script is definitely slower, but because it loads separately from the rest of your code visitors will see all your content before the new script kicks in, even if it’s at the top of the page.

In our testing, the overall page load time for the new script in the head tags was almost exactly the same as for the old script at the bottom of your page.

So why would you want to switch to the new script? The primary reason is that some advanced features of Google Analytics, like JavaScript event tracking, require the script to be embedded in the page’s head tags. If you’ve been wanting to use any of the customization and advanced features that require Google Analytics’ code to reside in the page header, but haven’t wanted to sacrifice page load times to get it, well, now you have your solution.

The new script and some new embed code can be found on Google Code. Keep in mind that the new script is still a beta, which means you might want to hold off using it on production sites.

See Also: