Tracking Outbound / Affiliate Links with getClicky

Clicky web analyticsI use Clicky for most of my day-to-day tracking and analysis, only using Google Analytics for the harder analyses. One of the things Clicky can do most wonderfully is track outbound clicks. There’s an issue however when you start routing your affiliate links through a script or on-site redirect. I redirect mine through /out/ here on, but not all of the /out/ links need to be tracked. Let me show you how I do track the ones I need to track.

Update: I ended upon adding this functionality to my Clicky for WordPress plugin.

Forcing Clicky to track a link as outbound

First of all, you need to know that when you add a class clicky_log_outbound to a link, Clicky will track each click on that link as an outbound link. Now I always add a class track or aff to my affiliate links that I want to have tracked, for instance:

<a class="track" href="">Clicky</a>

Of course I could manually add the clicky_log_outbound class, but that’s just a tad bit too much work, especially as most of my links have been “classed” already and I might want to use this class for other stuff later on.

Now, I add a tiny filter function to my sites functions.php file, this searches for links with class aff or track and adds the clicky_log_outbound class:

function clicky_outbound_filter( $content ) {
	$content = preg_replace('/<a([^>]+)?class="(aff|track)"([^>]+)?>/',
		'<a\1class="\2 clicky_log_outbound"\3>', $content);
	return $content;

add_filter( 'the_content', 'clicky_outbound_filter', 10, 1 );

That’s it! Clicky will now track those links as outbound. Now let’s set such a link up as a goal.

Goal Tracking in Clicky

For goal tracking you need to have a premium (read, paid) Clicky account, but it’s well worth it. Setting up a goal is a piece of cake. You go to your site’s analytics and then to Goals, Setup. You’ll see this interface:

Clicky goal tracking

You simply name the action, set the goal URL to be your outbound URL, you could do /out/clicky/ or, when you sometimes forget the last slash, /out/clicky*. You can set up revenue and even a funnel, a required page before one can reach that goal.

Once you’ve done that, the goals will show, in realtime, in your Goals overview and in your “bigscreen” Clicky display.

More tracking power: campaigns

This feature becomes even more powerful when you combine it with another great feature of Clicky; campaign tracking. Clicky fully supports the _utm type variables Google Analytics uses, so you can track campaigns and terms within campaigns. That is, in fact, how I did the tracking in yesterdays post about WordPress Dashboard widgets.

Tags: , runs on the Genesis Framework

Genesis theme frameworkThe Genesis Framework empowers you to quickly and easily build incredible websites with WordPress. Whether you're a novice or advanced developer, Genesis provides you with the secure and search-engine-optimized foundation that takes WordPress to places you never thought it could go.

Read our Genesis review or get Genesis now!

17 Responses

  1. Rebekka DeforceBy Rebekka Deforce on 26 January, 2012

    Sounds handy. I’m definitely going to try this. Thx for this tip Joost!

  2. Gijs BosBy Gijs Bos on 26 January, 2012

    Question: what is the benefit compared to Google’s Virtual Pageviews ( ) ? The virtual Pageviews method seemingly has the benefit of being fully integrated with Adwords / Analytics.

  3. Josh FialkoffBy Josh Fialkoff on 26 January, 2012

    Nice post Joost.
    I still don’t see the advantage over Google Analytics. With your GA plugin on WordPress it’s easy to track outbound links and with the new realtime functionality on Google Analytics it looks like the features are comparable.

  4. FritzBy Fritz on 26 January, 2012

    What if Clicky could be build in into “Redirection” Plugin of WordPress? Now that could be a real nice tool to work with… yep, loading those php-files right now… :)

  5. zambaniniBy zambanini on 27 January, 2012

    how do you rewrite your affili urls to come to /out/ ?

    • Joe ZepernickBy Joe Zepernick on 30 January, 2012

      I’d also like to see what they’re using for this. I’m currently using a plugin called affiliate link cloaking but I’m not a fan of how it handles this at all..

    • Ian Anderson GrayBy Ian Anderson Gray on 3 February, 2012

      Me also! I’ve always wondered how you do this. Do you do this manually, or do you have a script that rewrites urls to /out/ ? I’d love to know!

  6. johnBy john on 28 January, 2012

    If Clicky has no advantage over GA why would you use it? I find GA simple and direct and for most newbies the filtering you do to the cord will be a jargon!

  7. afrocosmopolitanBy afrocosmopolitan on 28 January, 2012

    Sounds interesting. Have to study it more to see the possility of implementing it.

  8. Jessica FrankieBy Jessica Frankie on 28 January, 2012

    I will try this out because I need it for several websites. Could I use GA instead? Which one is safer/easier to handle?

  9. Pass MatricBy Pass Matric on 30 January, 2012

    Nice Tip Joost.

  10. MartynBy Martyn on 1 February, 2012

    Another great tip!

  11. arafinshaonBy arafinshaon on 3 February, 2012

    Hmm sounds cool! I’m gonna try this. Tnx

  12. André ScholtenBy André Scholten on 8 February, 2012

    Did getClicky build in a timeout in the outbound link tracking script? Otherwise you’re missing some data ;)

  13. Max PenBy Max Pen on 8 February, 2012

    Again a nice share on a useful resource for bloggers.

  14. SmashiousBy Smashious on 13 February, 2012

    Thanks for sharing this. Will try it out.

  15. Mike KalamBy Mike Kalam on 13 February, 2012

    Great tool I will definately share link with my developer…

    Here’s another interesting chart by Nick Bilton of NYT that visualizes the number of links on the homepages of popular websites.