Google Analytics for your S3 bucket
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
php-ga @ 3a93d0c

Google Analytics for your S3 bucket


I want to see my S3 bucket stats in Google Analytics


build minimalistic Heroku app which acts as a redirecting proxy which hits Google Analytics server with every visit

My motivation

I host my download server for my Mac apps on Amazon S3. Also I host there XML files for Sparkle updater. I want analytics!

How it works

When someone requests, it goes to Heroku app, which:

  1. parses URL into domain, product and version (, TotalTerminal, 1.2.3)
  2. hits Google Analytics with event (category=domain, action=product, label=version)
  3. redirects to (HTTP 307)

In Action

	➔ curl -I
    HTTP/1.1 307 Temporary Redirect
	Content-Type: text/html
	Date: Fri, 09 Mar 2012 10:20:59 GMT
	Server: Apache/2.2.19 (Unix) PHP/5.3.6
	X-Powered-By: PHP/5.3.6
	Connection: keep-alive  


  • DNS, S3

    • originally:

      • had S3 bucket:
      • had DNS mapping: (DNS) -> (S3 bucket)
    • newly:

      • created new Heroku app: binaryage-leechgate with content of this repo
      • created new S3 bucket:
      • copied S3 bucket content: from to
      • set new DNS mapping: (DNS) -> (S3 bucket)
      • modified original DNS mapping: (DNS) -> (Heroku)
  • Heroku