Friday, April 20, 2012

Distilled bookmarklet modified to support GA Custom URLs

Tom Critchlow from Distilled released a bookmarklet this week that lets you instantly access the traffic stats in GA for whatever page on which you are navigating (assuming you have permission in GA of course).  It works perfectly on any site with GA so long as it does not use custom URL in the _trackPageview command (well over 90% of sites).

However, for sites like ours, we were out of luck because we always use custom URLs to give us finer tuned reporting and allows us to leave URLs optimized (or at least semi-optimized with what our CMS will allow) while having detailed and optimized data for reporting and analysis.

I have modified the script to work with sites that use custom URLs for tracking in GA as well as for standard implementations.

javascript:location.href=""+encodeURIComponent(":"+ (typeof _gat.N[0].F == "undefined" ? location.pathname : _gat.N[0].F))+"%26explorer-table.secSegmentId%3Danalytics.source/";

The key change is to substitute location.pathname from the original script and replace it with a block that checks for any custom URLs stored in GA for that page

(typeof _gat.N[0].F == "undefined" ? location.pathname : _gat.N[0].F)

The only caveat is that you are still out of luck if your use inbound filters to transform your URLs inside GA. Unfortunately, there is no easy solution other then creating a regex yourself to apply the same transformation to the URL.

Instructions for making this work on your site:
1) Go to Tom's post
2) Enter your code from GA as he mentions it in his post
3) Drag the bookmarklet to your toolbar
4) Right click the bookmarklet and edit the script by changing:
(typeof _gat.N[0].F == "undefined" ? location.pathname : _gat.N[0].F)

Change the part that says location.pathname to (typeof _gat.N[0].F == "undefined" ? location.pathname : _gat.N[0].F)
5) Click OK and you are good to go

Monday, April 16, 2012

GA is a bit confused this morning...

GA this morning forgot its cup of coffee

I am really enjoying the new GA v5, especially as they start porting some of the remaining functionality that has been missing these last months such as PDF and email support.  They even have improved the contrast in the latest iteration so I don't feel compelled to try to make GA higher contrast

One area, however, that I prefer from before was the main graph area.  It used to show the comparison information from previous periods as well as percentage differences. I suppose to save CPU they decided to remove that info and only post the standard aggregate data. The scaling also really needs some improvement because they play with the labels and scale with every change of a report.

Some things though you can just chalk up to being "beta".  This morning GA seems a bit confused on how to display its labels for time.  Look at the screenshot below. Hours are days and days are hours....feels a bit philosophical.
Not quite up to swiss watchmaker standards...

Hope they fix this later today.

PLUS: GA Evolution is Evolving

Also, I just wanted to give a quick heads up that I am completely rewriting Google Analytics Evolution.  The new version will be a responsive design in HTML5, based on Bootstrap, jQuery (of course), and the alpha (please don't break) version of the Google API Javascript Client Library.  I have all of the data pieces working and now I am just finishing the presentation of the returned data.

After that I will put Flot back into the mix and I'll relaunch.  This new verison will also include an option to sum/aggregate data from separate queries on the page.  Nothing very sophisticated and you'll need to be careful about aggregating averages, but for people who manage multiple sites but do not have "global" profiles setup in GA this can be a time saver.

Hope to have this released in the next week or two.