Google Analytics Event Tracking and Profile Filters

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?

Well, when I created the French profile with a specific "Include request URL" filter on it:

But the Event Tracking report stayed empty? As a Google Analytics technology nerd I wanted to get to the bottom of this.

To which pages are events attached?

The first question I needed to find out is to which pages the events are attached to. If you take a good look at the request that is being send to Google you will see this:

http://www.google-analytics.com/__utm.gif?utmwv=4.8.8&utmn=12345678&utmhn=www.example.com&utmt=event&utme=5(Print*Print-Page)&utmcs=UTF-8&utmsr=1600x900&utmsc=24-bit&utmul=nl&utmje=1&utmfl=10.1%20r102&utmdt=Example&utmhid=0123456789&utmr=-&utmp=%2F&utmac=UA-XXXXXX-1&utmcc=[cut-cookie-values]&utmu=7DMAg

In the UTME parameter are the event values: the category and the action. And as you can see: in the UTMP parameter is the URL that was in the browsers' address bar (%2F stands for /). Not the last virtual pageview URL, not the last real URL, but the actual URL in the address bar.

So the conclusion is: if you want to filter events, you need to filter the pages they were fired from. And if you're working with virtual pageviews you definitely have a problem.

Side-effects

It could be that your site reports 100 URL's in the Top Content report. But there could also be an extra 100 'hidden' URL's that weren't tracked with a trackPageview but did fire a trackEvent. You can find these url's in the Event reports:

Click on the 'Page' item and see which URL's are attached to the events. It could be that these URL's are not in the Top Content report at all. If I created a filter that would only include these URL's it could be that the profile would show 0 pageviews and 100 visits.

Is there a solution?

Well, not really. In most cases a filter on the right folder will work perfectly. Because most events are fired after a trackPageview call that used the URL from the address bar. But if you have a Flash/AJAX site, or some Game/Campaignsite that only uses events on special URL's you need to work out a proper solution.

In my opinion Google should attach events to the last URL that was being send with the trackPageview command. What are your thoughts?

Click to activate social bookmarks

 
  • Hm, interesting. Maybe they should add an trackPageview parameter to the trackEvent function to give some more flexibility to the user 😉 Or, indeed, add anything that comes between two 'pageviews' to the last (virtual) url they've received.