A better way of tracking feed subcribes

RSS Icon in Location BarI use FeedBurner, just like anyone else, to track my subscribers. One thing I really like to measure too though, is the number of feed subscribes, as in the act of subscribing. Now you can simply add onclick handlers for Google Analytics or any other stats package to all your feed links, but that means leaving one big gap: people can click on the RSS icon in their location bar, and there’s nothing you can do to track that. Until now!

The problem is that you can’t add an onclick handler on that icon, because it’s in the browsers UI, and not on your page. The browser grabs the info for that icon from the link rel="alternate" link in the head section of your HTML, you can even have multiple rel’s like that, and then the browser will show multiple options.

The solution is actually quite simple, you change the link in that link meta tag to another page. On that page you install a javascript tracker, with which you create a pageview or event, and then you do a javascript redirect to the original feed URL. The code doing that on my blog looks like this:

Update:  Niels convinced me with his comment below that this is not the way to go… I’ll have to think of another method.

<html>
<head>
<title>Thanks for subscribing to my feed! - Joost de Valk's SEO Blog</title>
<meta name="robots" content="noindex,nofollow"/>
<script type="text/javascript">
<!-- tracking action script from Google Analytics or whatever other stats package -->
window.location ="http://feeds.joostdevalk.nl/joostdevalk";
</script>
</head>
<body>
<h1>Thanks for subscribing to my feed!</h1>
Redirecting you to the feed URL! If that doesn't work, <a href="http://feeds.joostdevalk.nl/joostdevalk">click here</a>.
</body>
</html>

Make sure you don’t forget to add the noindex meta tag, as there’s no use for this page to show up in the search results, and the text, in case people have prevented their browser from following javascript redirects.

There’s one known issue with this way of tracking, auto detection of feeds, which some RSS readers etc can do, is now broken. I’ll be working on a way to fix that.

Tags: ,


Yoast.com 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!

10 Responses

  1. Joost de ValkBy Joost de Valk on 20 December, 2007

    Yeah, which Google Analytics and Mint unfortunately don’t do.

  2. Patrick AltoftBy Patrick Altoft on 20 December, 2007

    Something I’ve tried before is to cloak the page so that it 301 redirects if the user agent isn’t Firefox or IE. That way it doesn’t break the auto detection of feeds.

  3. Niels LeenheerBy Niels Leenheer on 20 December, 2007

    I’m not sure I like this solution.

    You are basically lying to the browser about the content type. You are telling the browser it should expect application/rss+xml at the alternative URL, but it’s plain HTML instead.

    I can actually lead to the inability to subscribe to your feed. For example try subscribing to your feed from Safari, it won’t work and Safari will show an error message instead.. Also external feed readers usually register themself at the operating system for the application/rss+xml type and fetch the alternative URL themselves. If they don’t understand HTML and Javascript – and I doubt any of them do – those feedreaders will never reach your actual feed URL.

  4. Joost de ValkBy Joost de Valk on 20 December, 2007

    Hmm Niels you’re right…. Shit :) Ok, I’ll have to find another way.

  5. André ScholtenBy André Scholten on 20 December, 2007

    You could do it with a 301 redirect but then your tracking software should support server-side tracking.

  6. MarcelBy Marcel on 25 December, 2007

    I Think its time for a new blog called “The best way of tracking feed subcribes” ;)

  7. Pascal Van HeckeBy Pascal Van Hecke on 8 January, 2008

    You could include a serverside http request to your statistics software/service for every request to the /feed/ url before redirecting to the Feedburner url. You’ll lose the ip address info, but you can echo other info from the original request such as browser type in the header sent by your script.

    Peter van der Graaf has written about similar setups:
    http://www.vdgraaf.info/google-analytics-without-javascript.html

    You would need to filter on user agent however to get the browser requests and not the Desktop feed readers/bots.
    What’s more: Mozilla/Flock often prefetch feed urls in the autodiscovery info, without the user actually subscribing. So you might want to measure subscriptions by measuring how many people follow the “path” (1 – request to feed url) (2 – request to image included in the html)

  8. ValdasBy Valdas on 20 April, 2009

    Javascript example code is not properly escaped in this blog entry so it actualy redirects to your RSS feed on feedburner ;) In order to read this entry I have to disable Javascript in my browser.

Trackbacks

  1. [...] A better way of tracking feed subcribes (Joost de Valk) [...]

  2. [...] It’s now possible to track people clicking on that RSS icon! Read how » [...]