Using segmentation in Google Analytics for WordPress RSS readers

One of the things I’ve been wanting to do for a while seems to be finally nearing completion. Google Analytics allows you to segment users into custom segments, and there’s one segment I’ve been aching for. I want to be able to segment RSS readers, to be able to see the different browsing behavior of new visitors versus my loyal visitors.

Getting to the point where I actually can acquire that data has been a pretty long ride. I first had to create a way to change the URL’s used in RSS feeds, so I could detect this different URL, 301 redirect it to the right URL, and set a cookie while doing that. To do that I filed a bug in WordPress’ Trac, which I wrote a fix for as well, someone else improved on it, and it was committed into the WordPress core. As of WordPress 2.3, you can apply a filter to the_permalink_rss, which allows me to add ?source=rss to any URL (or &source=rss when the blog uses the default ?p= permalinks).

The next step is detecting that parameter in the URL, and 301 redirecting to the original post URL. Before doing that 301 redirect however, I drop a cookie, which lasts for 30 days, identifying the user as an RSS reader. This allows me to, in the last step, add the following code to the Google Analytics script tag when the user has that cookie:


I will know if this works tomorrow, and if it does, I’ll release a new version of my Google Analytics for WordPress plugin with this possibility in it. Since I can imagine other people want to identify RSS readers for other purposes, I’ll release that small bit of code as a single plugin as well.

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!

13 Responses

  1. OzhBy Ozh on 15 October, 2007

    I’m your greatest fan now.

  2. Andy BeardBy Andy Beard on 17 October, 2007

    Redirecting after setting a parameter cookie is useful for all kinds of things not just in RSS feeds.

  3. Joost de ValkBy Joost de Valk on 17 October, 2007

    Heh I wasn’t saying I invented something new with that technique ;)

  4. Andy BeardBy Andy Beard on 17 October, 2007

    You know the only major problem with this seems to be that RSS links end up in all manner of interesting places where you happen to have syndicated your content, or where someone has used the link from the feed.

  5. Joost de ValkBy Joost de Valk on 17 October, 2007

    Yeah well actually I was thinking about that too, and I’m going to build in a strict mode, where it will only return true if the click came from no referrer, or a select group of referrers like google reader.

  6. OzhBy Ozh on 17 October, 2007

    Sounds very great. This, and the ability to add the ?from=rss to over links withing posts (internal links / all links)

  7. Joost de ValkBy Joost de Valk on 17 October, 2007

    Ozh: added both and released a new version.

  8. Andy BeardBy Andy Beard on 18 October, 2007

    I will keep conversation here

    Ok next stage :)

    For external links can your add ?source=permalink

    I want people to be able to see any traffic they receive from me, even if I can’t track it myself without using redirects.

  9. Joost de ValkBy Joost de Valk on 18 October, 2007

    Yeah I was thinking along the same lines :) Although to track your outbound traffic, you can just use my Google Analytics for WordPress plugin, it’s quite easy to use…

  10. Andy BeardBy Andy Beard on 18 October, 2007

    Not quite the same

    If people are looking at their stats and see that they have 50 page views on -plugin

    They will be able to see that whilst I only send 10 visitors from my blog, I send a lot more from RSS

    It could also just be ?source=andybeard if that plays better with Analytics for conversion tracking

  11. Joost de ValkBy Joost de Valk on 18 October, 2007

    They wouldn’t see that in their stats, as it 301 redirects, unless I built in a stats page for that, and a way for them to expose that they support outbound link tracking…

  12. Mark.JonesBy Mark.Jones on 23 May, 2008

    That is an interesting article. In our experience website owners find it difficult to understand visitor behaviour even with good systems such as Google Analytics.

    We have recently come across an excellent piece of software that not only allows them to monitor individual user behaviour in real time, but also facilitates direct engagement between visitor and user. This has been increasing conversions by an average of 15% in the websites we have implemented it in.

    It seems that the individualised data gives a more enlightening perspective.