Text Link Ads


Monday, June 30, 2008

Tracking Affiliate Links in Google Analytics

One challenge you will face as a poker affiliate (or really any affiliate for any product) is tracking when people click on links that go to the sites you affiliate with.  If you are an affiliate with UltimateBet for example and someone clicks on one of your UltimateBet links that click won't be tracked because the destination page is not on your site.  Even by using the redirection technique I described in this post Google Analytics won't track the page because the page is a redirect page.  Fortunately for us, Google has added some new tricks to its latest urchin javascript code which allow you to tag links and track them at the moment they are clicked.

For example let's say you are affiliated with Doyle's RoomDoyles Room Your link might look something like this:

<a target="_blank" href="http://www.lowlimitholdem.com/goto.php?target=DoylesRoom">

So when someone clicks the link it uses goto.php to redirect them to Doyle's Room with your affiliate code. This link won't be tracked. To track it change it to this:

<a onclick="javascript: pageTracker._trackPageview('/goto.php?target=DoylesRoom');" target="_blank" href="/goto.php?target=DoylesRoom">

The javascript inside the onclick event calls new Google Analytics code which will put whatever is inside of _trackPageView() as the page name to be tracked. For simplicity you can use the same page you're actually calling to track your outgoing clicks or you can create fictitious page names (like doyles_room_click.html) to track. The advantage of keeping there real page redirect is that you can filter inside of Google Analytics for "goto.php" and group all your outgoing clicks together.

For this to work you must be using the new urchin code we described in the previous post.

Good Tracking!