Re: Rim Bray’s essay about Counting

Re: Rim Bray’s essay about Counting Subscribers to an RSS feed, I like the idea of a unique hashcode, but I think many people will hate the idea of giving out their email address to generate it. One of the great advantages of RSS is that the subscriber never has to worry about getting spammed.

Here are a couple of different techniques I’m considering to accomplish the same thing:

  • HTTP 301 Redirect – Whenever someone access a feed for the first time, generate a unique subscriber ID and issue an HTTP 301 permanent redirect that includes the subID as a parameter. So http://myfeed/file.xml becomes http://myfeed/file.xml?subID=xxx
    In my limited tests, this approach does not work very well, mainly because not all aggregators support HTTP 301. Also, generating a unique URI is frowned on by some in the RSS community.
  • ETag – Similar to above, whenever an aggregator accesses a feed for the first time, issue an ETag header that includes a unique subscriber ID. I’ve just started playing with ETag, so I don’t know how widespread it’s use is on the aggregator side. Also, it may violate the spirit of what ETag was designed to do, which is represent the state of the object on the server, while my approach represents both the state of the object and the relationship between the subscriber and the object. Still, I like this approach because it’s really simple to implement.

    The way I do it, the ETag consists of two parts delimited by a hyphen. The first part is a timestamp of the last modification of the RSS document; this represents the true state of the object. The second part is the unique subscriber ID. In theory, aggregators should submit the last ETag received from your URI, which in my case looks something like 12345678-9876543. On the server side, I strip out the the part to left of the hypen and use that to determine whether to return the full document or just an HTTP 304 header. And I can use the digits to the right for logging unique subscriber activity.

    The first time an aggregator accesses a feed, it won’t have an ETag, so I generate one (and I can log this too, so I know how many new subscribers I’ve gained in a given period). If the aggregator is following the HTTP spec, it will include the ETag on all subsequent requests. As my RSS file is updated, I’ll issue a new ETag in which the left side changes. The right side will be generated on the fly based on the ETag submitted by the aggregator.

This entry was posted in Uncategorized. Bookmark the permalink.