Enhancing Google Analytics Using Greasemonkey

There is a new post that re-releases the script as a Firefox Plugin. Find it here.

My boss Zach has a problem. Every four hours the craving strikes him. No matter where he is, he pulls out his shiny Macbook Pro and navigates to Juice’s Google Analytics site. He pulls up the list of referrers to our site and meticulously searches for new domains. He has an freakish ability to pick out IP addresses that have never linked to us before. Even so, there had to be a better way.

I wondered whether Greasemonkey might be able to help. Greasemonkey is an extension for Firefox that allows users to install custom javascript when you visit a specific website. These scripts can add a delete button for Gmail, automatically display lyrics to your YouTube music video, or do pretty much anything else you would want to enhance the functionality of a website.

After poking around the subtleties of the Google Analytics interface, I came up with a little script that can identify the new referrals that Zach so desperately craves. When navigating to the "Referring Sites" section of Google Analytics, the script add the following button to the interface.

Google Analytics Button

Pushing the button downloads all the referrer data for the date displayed in the Google Analytics range, as well as a similar set of data for the range up to, but not including, the last three days. The difference between the two data sources is used to calculate all of the results. The specific number of days can be changed by editing the first line of the script. Greasemonkey then displays the results in two tables above the original Referrer table. (Greasemonkey works entirely within your browser shell, so your data should be quite secure.)

Google Analytics Data

The first table shows any sites that have displayed more than a 50% increase in visits over the last 3 days as compared to the rest of the time range. The second shows all new recent sites that do not appear at all more than 3 days ago. This can be quite useful to anyone, who, like Zach, absolutely needs to know about any new and exciting inbound links.

Installation Instructions:

Firefox 2.0+



If you don’t already have Firefox, install it. Install Greasemonkey, and do the required Firefox restart. You should see a handsome monkey peeking at you from the bottom right hand corner of your browser. Open the script file in your firefox browser, and Greasemonkey should give you an option to install the script.

Afterwards, log into Google Analytics, and navigate to your Referring Sources Tab. Click the button.