b5media.com

Advertise with us

Enjoying this blog? Check out the rest of the Technology Channel Subscribe to this Feed

New Linux User

HOWTO: Use Awstats To Count MP3 Downloads

by Jon on April 5th, 2006

I don’t know if this is really a ‘new’ user topic. Let’s call it a ‘new administrator’ topic and go from there.

I recently moved my podcast from Libsyn to my own box. About the only thing I miss is the Libsyn stats.

I’m using Loudblog software for my podcast now and while it has a stats section, it basically logs hits rather than complete downloads. It doesn’t do any magic in trying to figure out whether repeated hits from a single IP is one guy’s RSS reader or a bunch of people at work behind one router or anything. I knew that I would need better stats and now that the dust has settled from my initial server setup, Im looking after that.

I turned to Awstats because I’ve used it in the past and it has some really neat-o capabilities. One of the capabilities it has is the ExtraSection part of its config file. If you’re not happy with the default reports, you can create ExtraSection(s) to record whatever data you want. Well, more correctly, whatever data is available to be aggregated from your log file.

This isn’t a post on Awstats, rather it’s a post on how to build an ExtraSection to make Awstats count your MP3 and OGG file hits, their total bandwidth, and their last access date. I figure that if I have total bandwdith on a file-by-file basis that I can just divide that number by the file size, work in the total hit number for sanity, and get a pretty decently accurate number of downloads. It’s not perfect, but it’s a hell of a lot more accurate than what we’re accepting for web site stats these days.

Here’s my ExtraSection to count MP3 and OGG downloads and bandwidth:

ExtraSectionName1="MP3 and OGG Downloads"
ExtraSectionCodeFilter1="200 304"
ExtraSectionCondition1="URL,(.*((\.mp3)|(\.ogg)))"
ExtraSectionFirstColumnTitle1="Download"
ExtraSectionFirstColumnValues1="URL,(.*)"
ExtraSectionFirstColumnFormat1="< a href = 'http://%s' target=new title='Click to download document' >%s< / a >” (ignore the spaces - had to put those in for formatting)
ExtraSectionStatTypes1=HBL
ExtraSectionAddAverageRow1=0
ExtraSectionAddSumRow1=1

Hope that helps someone.

POSTED IN: How To

2 opinions for HOWTO: Use Awstats To Count MP3 Downloads

Have an opinion? Leave a comment:




Check Spelling
Activate Spell Check while Typing