Track podcast downloads as Google Analytics events with this free PHP script

A podcast listener wearing headphones on a busy city street
This is a potential podcast listener… do you have the stats to prove it?
As regular readers of this website know, I host a few podcasts, including Wrapp Up (a podcast about awesome apps) and Not a Real Job (a podcast about digital marketing).

While we get great subscriber stats through FeedPress and great website analytics through Google Analytics there was still no single place to see how many people had downloaded a given episode of the show. FeedPress offers download stats, but only for episodes downloaded via the RSS feed; anyone casually listening on the website would be ignored.

I knew there had to be a solution, so my friend Nick Sampsell and I cooked up this cool little script that triggers events every time your listeners download a file. We call it Downloadalytics, and it’s free on Github.

Screen Shot 2014-01-21 at 07.36.29Each file gets its own entry in Google Analytics, so you can easily track which files are the most popular.

There are full instructions on the Downloadalytics Github page that should walk you through the basic setup of the script. I’ve included comments in the source code that should help as well.

If you need more specific help, we are available to install the script as well, for $200 per install. You can get in touch at the Van Patten Media website, and we’ll be in touch ASAP to help!

photo credit: Kris Krug via photopin cc


Sam Carlton April 6, 2014 Reply

I’ve been looking for something exactly like this! You’re the freaking BOSS!

Randal Flamm April 14, 2014 Reply

How do I call download.php? Where? In the xml file?

Si_bone December 10, 2014 Reply

I know this is kinda old, but is there anyway you can post a working example of the filled out file?

Jezper Söderlund May 7, 2015 Reply

Great one, all set up now, and downloads are counting.

One question though, this kind of traffic that generates these events, they do not bring with them any other information. Is it at all possible to collect data like device or operating system?

Lea Pica August 6, 2015 Reply

Great article! Is there a solution for using this with Google Tag Manager?

Ennemis December 1, 2015 Reply

Hi Chris, we’ve had Downloadalytics installed and running for the past few weeks. It’s been working great. But we uploaded our second podcast episode last week, and it appears that Downloadalytics is still only reading info from our first episode. The cause doesn’t seem to be the file type. Any advice for a couple puzzled musicians? Thanks!

Leave a Reply