Tracking Custom Facebook Tab Pages With Universal Analytics

I was recently involved in setting up Universal Analytics tracking for custom Facebook tab pages for a client. At the start of this project, I set out to source some examples.

And although I found a couple of excellent topical resources (e.g. Eivind Savio or Lunametrics), none of the resources I found described how to do this with Universal Analytics. The resources I found all described tracking custom Facebook tab pages with the asynchronous version of the Google Analytics tracking code.

Now that I have figured out how to do this with Universal Analytics I decided to write this blog post. Hopefully it will be of use to people who want to track their custom Facebook tab pages with Universal Analytics.

First of all, what are custom Facebook tab pages ?

Tabs are the navigation items under the profile image on your Facebook page. You will typically see tabs such as “Timeline”, “About”, “Photos” etc.

Until 2011, custom tab pages used to be created using Facebook Markup Language (FBML).

Since March 2011, custom tabs are created using iframes. Since these iframes can contain HTML, Javascript and CSS this opens up a realm of possibilities in terms of design, but also tracking these Facebook iframe tab pages with Google Analytics.

The main issue with tracking traffic to Facebook iframe tab pages is that Facebook will not reveal the real referrer. Instead, you are most likely to see a referrer like “static.ak.facebook.com” popping up in your list of traffic sources. And when you use Google Analytics campaign tracking parameters in the URLs that send traffic to your iframe tab pages, those parameters will not be passed on. So you won’t be able to track your campaign traffic.

Other than that, tracking Facebook iframe tab pages with Universal Analytics works exactly the same as tracking any other web page. You can use event tracking and set up goals to track the usage of your tab pages.

Work-around to ensure correct referrer tracking

What you need to do to make sure referrer information is recorded correctly, is to set up a redirect page. This redirect page is where you point all campaigns with campaign tracking parameters and traffic generation actions. The role of this redirect page is to redirect to the Facebook iframe tab page.

On this redirect page, you add a piece of Javascript code containing the Universal Analytics tracking code. This code should fire before the redirection kicks in. Hence the delay in the code fragment here below. This will ensure referrer information is passed on and tracked correctly.