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+
Greasemonkey
googleanalyticsdownloade.user.js

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.

This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 United States License. All source code is released under a BSD License unless otherwise specified.

21 comments | Show all comments only the last 5 are shown


May 1, 2008
Tim said:

Hi Sal,
thank you so much - I just reinstalled it and now it works! This is really fantastic!
Thanks,
Tim


May 7, 2008
Nate Sidmore said:

Awesome tool Sal, (thanks to Avinash for the tip).

I did run into a problem with the Firefox pop-up message "Warning: Unresponsive script". However that problem can be solved by lengthening the time allowed for scripts to run. For more details go to http://lifehacker.com/software/firefox/put-off-firefox-15s-unresponsive-script-dialogue-162574.php

However I was bummed when after setting the time allowance to 10 minutes, and clicking the "Who Sent Me Unusual Traffic" button in GA, the script ran for 9 min 38 sec before returning results. Any tips on getting quicker returns?


May 7, 2008
Chris Gemignani said:

Nate:

Thanks for the encouragement. If you check our "Keyword Trends" Greasemonkey script (linked at the start of this post), we write about how to change the parameters in the script to make things run faster.


June 19, 2009
Edwin said:

How can I only bring up the report for non-paid keywords? Selecting it and then returning the results, still brings up cpc words as well.


February 22, 2010
Shankar said:

This is a nice tips, I 'll use it fro my site http://www.onlinegk.com

Your name

Email (optional, will not be shared)

Type the word "juice" (required to confuse the spammers)

Your comment


Add a comment