Using Google Analytics Events


For many people, the tracking provided by using the tags that Google Analytics generates for them will be sufficient. Those tags track the basic metrics for you; pageviews, visits, visitors, source, etc. However, for many websites, that data alone is not enough. Perhaps you have some downloadable whitepapers, or a registration form on your site. If you really want to capture this data, you need the power of Google Analytics Events.

 

Some actions aren't automatically captured in Google Analytics, and, in order for data to be captured in Google Analytics, you need to have event code on that particular page. Some common examples of actions that are not tracked by default include:

  • Exit links from your site
  • Downloads
  • Some shopping cart behavior

The syntax for setting an event in Google Analytics is fairly straightforward. Where the event happens on a page, you just need to add the following code (asynchronous code shown):

_gaq.push(['_trackEvent', category, action, label, value]);

Where bolded values must be populated by you. This can be done dynamically, for example, by using product data in your shopping cart, or statically, such as with a specific video file.

This code can be placed in any sort of event, ranging from an onClick event for a link (onClick="_gaq.push(['_trackEvent', category, action, label, value]);") or in the submit button on a page, or just with the regular tracking code on a particular page (like a shopping cart).

It is very important to make sure that you use a consistent and well thought out naming convention for your events.

The components of the _trackEvent method are as follows:

Category: The name of the category that this event will roll up into. For example, "shopping cart," "media," or "downloads." The figure below shoes how the category information for events appears in your Google Analytics reports:

GA Events: Categories

Action: The action that was performed. For example, "add," "view," "purchase." Again, the figure below shoes how the action information might appear in your Google Analytics reports:

GA Events: Actions

 

Label: An optional label for the event. If the event was a shopping cart, add event, you may want to use the name of the product. If the event was a video play event, you could use the name of the video.

Value: An optional value for the event. For product adds, this could be the price of the product that was added. Using the value field could give you a good idea of the amount of additional revenue you could have converted, and whether or not it is worth remarketing to those visitors.

 

That should be enough to get most users started on events, however, for more advanced users, you can also consider the following. In some cases, you may want an event to only happen the first time a visitor does a certain action on your website and this is where you want to look at "Unique Events." Unique Events only count an event if it was the first time the visitor did that event during their visit.

One last thing to note, if you've been upgraded to the new Google Analytics version 5, you will be able to define goals based on events.

So, do you have any questions? How have you been using events on your site?



Add this article to your favorite Social Bookmarking websites
Reddit! Del.icio.us! Mixx! Free and Open Source Software News Google! Live! Facebook! StumbleUpon! TwitThis Joomla Free PHP
 

Add comment

Security code
Refresh

Search
Subscribe to RSS Feed
MaassMedia