Automatically Show All Profiles in GA
Update: I’ve added an additional URL to when this script runs. It now runs on https://www.google.com/analytics/settings* as well. If the script stopped working for you, this was probably why and should take care of it.
You can also make this change to the existing script by going to Tools->Greasemonkey->Manage User Scripts. In the Included Pages area, click the Add button, paste in the above URL, and click OK.
————–
I was recently asked by Espen at zedge.net if there was anyway to automatically show all your profiles for the website profile list in GA.
The default is to display 10 profiles and you can either 1. page through them (painfully) in sets of 10 per page or 2. Select from a pulldown how many you want to show at once.

But when you have a lot of profiles it becomes annoying to select “Show 100″ every time you see this screen.
So, I wrote this very simple greasemonkey script that watches for certain location.hrefs (URLs) and adds the parameter ns=100 to the end of the URL. The ns=100 parameter directs GA to show 100 profiles at once (which is the highest option in the pulldown).
If you don’t already have Greasemonkey installed you can get it here.
Then download and install the Show 100 script. (If you have greasemonkey installed, you should be prompted to install the script when you click on it. Otherwise download it and use the greasemonkey interface to add the script).
It is not a perfect solution but it has worked well for me so far, and it may help you put off that carpal tunnel surgery for a while longer. If you have a better or smarter way to accomplish the same thing, let’s discuss it.
UPDATE: André made a code suggestion (see comments) which I have incorporated into the script. Now it will not add the &ns=100 parameter if there are 10 or fewer profiles. Thanks André
-John







June 12th, 2008 at 12:23 pm
Nice work John! This is a helpful little time-saving tool.
June 12th, 2008 at 1:11 pm
Not sure what you mean by “not a perfect solution”. I don’t see anything wrong with it at all. Seems like it does exactly what you want it to do with very little load time. I’m happy with that.
June 13th, 2008 at 7:51 am
Very helpful…thanks!
June 14th, 2008 at 2:04 am
This Greasemonkey script is exactly what I’ve needed! It’ll be a real time saver. Thanks, John!!
June 16th, 2008 at 1:16 am
That’s just marvelous, it makes me go to work excited to open my GA accounts! Really helpful extension, you are turning the life of Web Analysts an easier life
Thanks.
June 16th, 2008 at 7:53 am
Good solution - I hope that the folks at the Google Analytics team will pick up the idea and implement this (and a number of the other issues that you have described previously) in GA itself. A good sign of when you have to adjust your product is when the market starts to design workarounds !
June 16th, 2008 at 11:27 am
Thanks for the comments, everyone. I really appreciate the feedback.
June 17th, 2008 at 8:34 pm
This is simply great! Strike one pet-peeve off the list in my daily online marketing chores.
Thanks so much John.
June 19th, 2008 at 3:16 am
Hi John,
I added some extra code to check whether there are more than 10 profiles or filters. That way account with less profiles/filters won’t get the hard coded redirect.
This is the code I use:
links = document.getElementsByTagName(”a”);
for (var i = 0; i < links.length; i++)
{
if (links[i].href.match(/sn=11/))
{
if (!window.location.href.match(/\?/)) {window.location.href = window.location.href + ‘?ns=100′;}
else {window.location.href = window.location.href + ‘&ns=100′;}
}
}
June 19th, 2008 at 7:32 am
Thanks Andre.
I appreciate you taking the time. I’m going to update my script and try it out now.
June 19th, 2008 at 8:59 am
Andre,
I modified your code slightly, and I plan to update the hosted script. Here’s what I have:
atags = document.getElementsByTagName(”a”);
var foundNext = 0;
for (var i = 0; i < atags.length; i++)
{
if (atags[i].href.match(/sn=11/)){ foundNext = 1; break;}
}
if (foundNext = 1 && !window.location.href.match(/ns=/))
{
if (!window.location.href.match(/\?/)) {window.location.href = window.location.href + ‘?ns=100′;}
else {window.location.href = window.location.href + ‘&ns=100′;}
}
June 19th, 2008 at 9:06 am
Hi John,
Nice addition, now it’s complete.
Ps. You need to change this line:
if (foundNext = 1 && !window.location.href.match(/ns=/))
to:
if (foundNext == 1 && !window.location.href.match(/ns=/))
June 19th, 2008 at 9:15 am
oops. thanks.
June 27th, 2008 at 8:25 am
Hi John, I got some other improvements:
1. When I click “edit” next to a specific filter I go to the edit page. The script automatically redirects me to the ns=100 version, but that isn’t necessary. I changed the seconde if statement to this:
if (foundNext = 1 && !window.location.href.match(/ns=/) && !window.location.href.match(/rid=/))
2. Because of the reload function in the script the back button functionality gets broken, you have to click it twice if you want to navigate back. You can fix this by replacing the location.href function with location.replace. The last one replaces the url and removes the old one from the browsers history. So if you click on the back button you will navigate the right way:
if (!window.location.href.match(/\?/)) {window.location.replace(window.location.href + ‘?ns=100′) ;}
else {window.location.replace(window.location.href + ‘&ns=100′);}
HTH
June 27th, 2008 at 10:00 am
Thanks André,
I’ll try to get those changes in today. I think you’ve now done more work on this script than I have.
I’ll also mention that Jeremy at ROI Revolution has incorporated this idea into his GA Report Enhancer greasemonkey script. Anyone who is interested can take a look at what he’s doing at
http://www.roirevolution.com/blog/2008/06/google_analytics_report_enhancer.html
July 28th, 2008 at 3:21 pm
Code Speed Suggestion:
To check if the current setting is ’show 10 rows’, currently you are looping through every link on the page until you find the next link. Instead I’m going to suggest this:
var tempIndex = 0;
// find the form named ‘length’
for(var i = tempIndex; i < document.forms.length; i++){
if( document.forms[ i ].name == “length” ){
tempIndex = i;
break;
}
}
// grab the form
var tempForm = document.forms[ tempIndex ];
// grab the form’s one and only select box.
var tempSelect = tempForm.getElementsByTagName(’select’)[0];
if( tempSelect.options[ tempSelect.selectedIndex ].value == “10″ ){
// do url change here.
}
What do you think?
Erik.
July 29th, 2008 at 12:55 pm
Yes, I’ve somewhat neglected this script.
Originally the script was just 3 lines:
if (!window.location.href.match(/ns=/))
{
if (!window.location.href.match(/\?/)) {window.location.href = window.location.href + ‘?ns=100′;}
else {window.location.href = window.location.href + ‘&ns=100′;}
}
The current code with the loop was added after Andre (see comments) pointed out that my version would redirect even if the account had 10 or fewer profiles.
Grabbing the form by name and going from there is certainly more elegant. You might be interested also in checking out Jeremy’s approach — he incorporated the idea into GA report enhancer (see comments).
When I get some time I’ll plan to revise the script with your improvement.
Thanks for the feedback.
August 7th, 2008 at 11:42 am
Great! I felt just the same about that! It’s annoying to be clicking on “show 100″ every time you log in. Very useful, thanks and congrats!