A lot of site owners want to track outbound links so they can see how often they are clicked. It's also useful to see when and where people left your site. Google Analytics knows the exit time of your last page, where in normal cases the last visited page is not counted in the spend time on site/page.
But, there is a big but. A lot of outbound link tracking is done like this:
[code lang="html"]<a href="http://andrescholten.net" onclick="trackClick(this)">Nice site</a>
And this is what happens when you click on this outbound link:
- The onclick is executed first
- The trackClick function generates an IMG element with a URL that points to the Web Analytics vendor
- The onclick function is handled and the browser starts with the href part
And then the race starts:
With the new release of ga.js this is possible. In the old days a fired event immediately after a trackPageview would cause Google Analytics to report a 0% bouncerate for that visit. But sometimes you don't want that behavior because the event is not always triggered by the visitor.
For instance: I track page load times the same way Google Analytics does, but in an unsampled way (Google only meausures 10%). To do that I fire an event immediately after the trackPageview, but I do that in another profile with a different UA-XXXX-Y number so it won't affect my bouncerates. But now we have an extra parameter:
_trackEvent(category, action, opt_label, opt_value, opt_noninteraction)
If you set this opt_noninteraction (boolean) to true it wil not affect bouncerates!!! That makes it possible to:
A while ago I wrote an article about a method to track page load times in Google Analytics. Short after this article Google came with their own technique to track page load times, but both methods have some disadvantages.
To give a clear understanding about the differences I want to show you this image:
In the rebound an article about the tracking of your site's performance with Google Analytics. Almost a year ago I wrote this article in Dutch, but there are some improvements that made life easier. Google Analytics released the 'set events as goals' functionality that is really helpful here.
The script I'm going to explain will track page load time and page render time per individual URL. I know some other articles that describe a comparing technique but I really think the way I use it gives you more insights (at least for smaller sites).
Sitespeed tracking is important
I don't have to tell you how important it is to know how visitors experience your site. Sluggish sites will cost you money in the end. Site speed is a minor SEO ranking factor and fast sites tend to have more pageviews per visit and a higher conversion rate.
Last week I ran into an interesting situation. I wanted to create a profile for a specific subfolder in Google Analytics. And I only wanted the events that where launched from pages within that subfolder to be reported there. This graphic shows you the situation:
A visitor lands on the homepage, he than goes to the French subfolder (what is a virtual folder because the entire site is working with AJAX). And than he decides to read some Dutch texts to have a good laugh about the weird language. On both pages he prints out the text he found there, what is being measured with Google Analytics' event tracking system.
Nothing strange now right?