Keyword Trends in Google Analytics With Greasemonkey
By Sal Uryasev
April 23, 2008
Find more about:
webanalytics
google
analytics
hack
greasemonkey
There is a new post that re-releases the script as a Firefox Plugin. Find it here.
After the warm reception for the first version of our Enhanced Google Analytics, we decided to add some new functionality. (Nothing like a few kinds words to keep us in the giving mood.) The first script created a couple new tables in the Google Analytics interface that highlight recent changes in referral visits. It uses Greasemonkey, an add-on for Firefox that allows a user to insert javascript directly into a webpage.
Our update gives you even more ability to understand the data in Google Analytics:
- At the suggestion of Avinash Kaushik, the new script works for keyword data, helping you see how organic search traffic is changing. An increase in a keyword may indicate a general change in user interests and/or improved performance on search results.
- My coworker Pete Skomoroch also suggested that I add the ability to see declines in referrals and new keyword searches.
- With the help of Paul Irish, the script is now better able to interface with the date widget on the Google Analytics site.
(Click the above button for a simulation.)

When you click the button, your browser will download some historical data behind the scenes, and display a nice summary of the best and worst performing keywords/referring domains.
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 or Keywords Tab. Click the button.
Configuring the script:
We spent some time trying to find convenient default settings here at Juice Analytics, so the script should work straight out of the box. Some users, however, may find it convenient to alter some of these configurations. To do so, in Firefox, go to Tools=>Greasemonkey=>Manage User Scripts..., select Google Analytics Downloader, and then click Edit in the lower left corner of the window. This should open up the script file in a text editor. If your computer does not have a default text editor configured, you may have to choose one. 'c:\windows\notepad' is a good bet for Windows machines.
This is what you should see:

The bracket labeled 'keywords?' controls defaults for the Keywords page, and correspondingly, 'referring_sources?' controls the Referring Sources page.
To change the settings, simply change the corresponding variable to your preferred default. Make sure to refresh your Google Analytics webpage, if you have it open, so the new settings are loaded.
Now for the nitty gritty configuration details:
- display_limit: This controls the maximum entries that each table will contain. This may be useful for large, sprawling sites.
- growth_tolerance: This is the percentage growth parameter. Changing it to .10, for example, will catch everything that has grown by 10%, as opposed to the default 50% and 20%, respectively.
- minimum_number_elements: This is a significance benchmark that can be used to limit what is displayed upon the screen. By default, only keywords with at least 10 elements are displayed upon the screen. Referring Sites does not have a minimum by default, but one can be set if desired.
- limit: Limit is more of an internal parameter that determines how many entries should be downloaded from Google in order to get the results that are visible here on the page. Lower the limit to increase speed. If the limit is set to a very high number, you will get the largest result set, but you will have to sit around for a while for the results to load. Since the results are downloaded ordered by volume, raising the limit from the default numbers will not actually give more significant results. You will simply get more of the smaller results, such as keywords with only 1 hit.
- look_back: This is a very important parameter. The script uses the date displayed upon your Google Analytics page to determine the full range that you want to consider in your results, but 'look_back' determines how many of those days are used for the significance test. So, say the range you have displayed in Google is March 23 - April 22 and your look_back is 7 days. The script will compare the average referrals for a given keyword from April 16-22 to the average from March 23-April 15, and will return the keyword only if the recent average is 20% higher than the rest of the time period. Thus, if you want to increase the total range of the data, change the dates on the actual webpage. Change 'look_back' only if you want to change the period of significance.
Happy analyzing!






41 comments | Show all comments only the last 5 are shown
Avinash Kaushik said:
Sal: Thanks so much for this enhancement to the first script, given all the attention on Search I think this is absolutely super valuable. I am on a recommendation overdrive on this (I have a two slides on Juice in my official presentations! :).
Thank you again, this is excellent.
-Avinash.
SM said:
Thanks for pulling these scripts together, very useful.
Patrick H. said:
This is great, thanks a lot for posting it. Very good addition to GA.
James said:
Why didn't google analytics do this months ago?
This is great!
I wear many hats at my company. As entertaining as it may be, I don't have the time to play in excel.
Thank you!
Brian said:
Great work guys! This is killer!
New to the blog, but you've won a reader. ;)
Sascha said:
Thats perfect man!
Please more of this awesome features :)
Best Regards from germany
Tim said:
Great tool! But sadly it doesnt work anymore in FF 3. Do you have an update?
Regards, Tim
spudart said:
Yes, I love this tool. Unfortunately ever since Firefox automatically updated itself from 2.0.0.14 to 2.0.0.15, it doesn't work anymore in 2.0.0.15. An update would make my day.
Sal Uryasev said:
Silly Firefox. Thanks for pointing it out!
The script should work if you reinstall it now.
Steve said:
I'm having trouble getting any results to return when running the script. In one week we have about 9,000 different keywords sending traffic to our site - any thoughts on configuring some of the settings to retrieve results? I just get the "loading..." button showing for minutes on end. Maybe increasing the growth_tolerance or lowering the limit?
michelle said:
I don't understand how to get grease monkey to work - i followed all the install directions fine... now that its installed though I don't know what to do... can anyone help me? not sure I'm even in the right place :/
Teri said:
Your instructions state "Open the script file in your firefox browser." This is where I am getting lost. How and where do I open it? The link takes me to another page, and I can't download the file. Help, I am stuck.
Teri said:
Never mind - I found the install link on the scripts page. I have installed greasemokey and the script, re-started Firefox, gone to Google Analytics, and I am not getting the "Who sent me unusual traffic" button. Please advise.
Sal Uryasev said:
Are you guys going to the Keyword/Referring Sites sections of Google Analytics? The buttons are hanging out on those specific pages.
Laurence said:
Thanks so much for this script! One question, I was browsing through the code but haven't done much web coding in a while. If I wanted to adapt this for bounce rate (to see the outliers for bounce rate) what would I want to change?
I feel like I would just need to change which element in the array you are comparing and then sort by that element but I'm sure it's probably more complex than that. If you at least point me in the right direction, I can mess around with it some more.
Bjoern said:
Hi,
the script has been very useful for us, but with last week's small Google Analytics Rebrush it fails to work for me on Firefox2 and Greasemonkey. Is this something you can confirm or are we (two colleagues) a singular problem?
Chris said:
Hi There,
This has been working for me very well but lately , it does not seem to go past the loading stages when I click the button?
I dont see any new results...
What do you think has happend?
I use the latest version of greasemonkey and firefox?
Any ideas?
Chris Avery
Bleue said:
I have the same problem: loading...
but nothing happens.
Chris said:
Hmm, I think this is a new problem, I am looking for a solution, if I fine one I will post it here.
Chris Avery
Sal Uryasev said:
I updated the script. Google Analytics changed their URL around slightly, adding "#lts=1221579205724", which messed with the script.
Uninstalling and reinstalling the script would probably be the easiest way to install the update.
Chris said:
Hey,
Thanks for taking the time to do that , we all appreciate it
Cheers
Bjoern said:
Hi Sal,
thanks for updating this so quickly. I'll check it out. It really is a great script.
@ All: Sal and the Juice Analytics Team might appreciate it, if users became "fans" of the script at the download location at userscripts.org - so that there is some recognition.
Katie said:
Thank you so much for your clear explanation of how to intgrate this awesome script into GA. Anytime you can dumb it down a little for us non-web developers/coders it is much appreciated. Marketing Mavens everywhere thank you!
don said:
Sal,
Thanks to you and yours for sharing this script. I installed it into my GA account and saw it working in both reports. Now, when I try to run the script in the keywords report, nothing happens. The button changes to say "loading" but no data gets presented. In the referring sites report, the script appears to be working. I am not a programmer or developer. Is there anything I can try to get the script working again for keywords?
Sal Uryasev said:
Hey Don,
Is it possible that you installed the script initially before September?. Google did a redesign of the site that necessitated a fixup of the script around that time.
don said:
Sal,
Thanks for responding to my plea for help. I don't think it was back that far when I installed the script. Unfortunately I forgot to make a note in my configuration tracking document of the day I installed the script. It sounds like you might suggest that I download the script and reinstall it? If so, is there anything I need to do to uninstall it first?
Sal Uryasev said:
It is worth a try.
If you go to Tools => Greasemonkey => Manage User Scripts..., you can select uninstall there.
Milttea said:
HI
After installing Greasemonkey I navigate to Tools => Greasemonkey => Manage User Script. I do not see Google Analytics Downloader. Please advise
don said:
Sal,
I tried the uninstall, reinstall method and still get the same results. The button changes to "loading" but nothing happens. It continues to work in the referring sites report. Any thoughts on what else I can check?
Gavin Doolan said:
Hi
This is a great script, one way to improve it though would be to have a way to visual the data in terms of a graph.
Currently you can try the Google Analytics graph options, but it doesn't really provide any insightful data.
Nice script and thanks.
Cheers,
Gavin.
GL said:
Along with Milttea above Google Analytics Downloader does not appear.
don said:
FYI, I figured out that my problem was being caused by a Firefox extension, SEO for Firefox. Disabling that and reinstalling Greasemonkey and the script have solved my issue.
Darren said:
I just downloaded this yesterday and I seem to have the same "Loading" hang that others have mentioned. I've tried disabling the other user scripts I use (only a couple) but that doesn't seem to help.
The potential looks great - especially where our top keywords are always the same and we want to see what's generating any new/incremental buzz.
Thanks
Clive said:
Great stuff. One of two recommendations put forward by Avinash so thank him for that and thank 'you' for making a very very useful tool.
dot said:
I've been using this for a while and I love it, but recently it stopped working, and just sits there on "loading". I tried downloading the new version. I tried uninstalling and reinstalling greasemonkey. No luck. I don't have any other scripts running, and I'm running firefox 3.0.6. anyone have any ideas? this script is so useful it's addictive, and now I'm lost without it!
thanks,
dot
dabbled.org
Sal Uryasev said:
Hey dot,
Thanks for letting me know. I'll take a look at it. Occasionally google changes the way they run things, and the script needs to be updated. I'm actually really close to re-releasing this script as a firefox plugin, so that I can utilize the automatic updates, and then no-one has to re-download or notice it being broken in the future.
dot said:
Thanks! that would be cool..
Sal Uryasev said:
There is an version of the new and improved Firefox addon that encapsulates this functionality. It is faster, sleeker, and it will have automatic updates. You can find it here: https://addons.mozilla.org/en-US/firefox/addon/11120
It is still experimental so users who want to download it have to log into addons.mozilla.org. I need a few user reviews before I can nominate the addon to be fully public (and easy to install). So, leave reviews if you happen to wander by there.
I'll publish a blog post once I can get the addon into the public part of the addons site.
Dave H said:
Hi,
Installed fine both using Greasemonkey/FF Add-In, however when I push the button I can see the table briefly appear but almost instantly disappear. Instead, multiple sort asc/desc triangles appear in the main Site Usage table. Does it interfere with other plug-ins?
(Also it only works when you access GA directly (the orange version) as opposed to via Adwords (the green version) - but that's not the main problem!)
Sal Uryasev said:
Hey Dave,
My particular plugin is very non-intrusive. While it should not interfere with any other plugins that I know about, if you have something that is quite intrusive, there is always a chance. It does sound as if you have something extra installed that kicks off after the script runs... maybe some kinds of special scripts to neaten up webpages?
steve said:
Hey Dave,
Thanks for the plugin, but I can't get it to work.:( I'm on firefox 3.0.1 and I can see it installed and I restarted like it asked. Then I go to google analytics page and no blue button.
Can you help me? I realize this is in Beat and I should expect this.
said:
Add a comment