Google Analytics recognises 41 search engines by default. Although this is constantly being added to, there are of course a great many other search engines in the world – language and region specific, as well as price comparison and vertical portals.
This hack is for anyone who manages SEO at a regional level i.e to be able to differentiate regional variations of search engines. For example, the default Search Engine list for Google Analytics shows aggregate search engines – Google, Yahoo, MSN etc., this hack shows regional specific ones for your SEO efforts.
April 2011 – New async hack launched
This hack has been completely revised for the latest GA async code. Further info >>
[ Now 100+ additional SEs + GA defaults (140+ domains). You no longer need to re-define the default set of search engines as this hack now prepends new search engines to GA's list. For details on new prepend revision see: code.google.com ]
Sample list of regional search engines:
- Google.com
- Google.ca
- Google.com.au
- Google.co.uk
- MSN.co.uk
- MSN.fr
- eniro.se
- eniro.no
- maps.google.com (local search)
- etc.
It is straight forward to add to Google’s list of recognised search engines – you simply add your own as described in the following Help Centre article . However, the Help Centre article cannot customise the list – only add new search engines. That is, "google" as a whole has already been defined so adding google.co.uk to the list won’t work as – it’s too late.
This hack was written to enable you to do this (original 2007 post here ).
Some further background…
I discuss this hack in Chapter 9 of the book and show the script to do this. However recent changes in the Google Analytics Tracking Code (GATC) has meant that the code no longer works written as it was.
Fortunately after some experimenting (a pseudonym for trial and error!), and help from Tomas Remortigue from Mountain View (all round nice guy and Google Analytics technical wiz), the hack is now fixed and back working
How to track regional search engines
From the book, this is a simple update with respect to the placement of code – the call to the custom_se-ga.js . You can host the script locally (get the file from my scripts directory and place it in /scripts
on your web server), or simply link directly to my file as shown.
The JavaScript file first clears the default list of search engines in Google Analytics and then defines 100 regional specific ones. Below is the layout you need to use for GATC:
Schematically, change your standard GATC from:
1 2 3 4 5 6 7 8 | <script> // load the ga.js file </script> <script> // set account number // track pageview visit </script> </code> |
to:
1 2 3 4 5 6 7 8 9 10 11 | <script> // load the ga.js file </script> <script> // set account number </script> <script src="http://www.advanced-web-metrics.com/scripts/custom_se-ga.js" type="text/javascript"></script> <script> // track pageview visit </script> </code> |
Notice the bold line inserted between setting the GA account number and tracking the pageview.
So a full GATC will look as below (remember to replace the account number, beginning with "UA-" with your own):
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | <script type="text/javascript"> var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www."); document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E")); </script> <script type="text/javascript"> var pageTracker = _gat._getTracker("UA-123456-1"); </script> <strong><script src="http://www.advanced-web-metrics.com/scripts/custom_se-ga.js" type="text/javascript"></script></strong> <script type="text/javascript"> pageTracker._trackPageview(); </script> </code> |
Note: The syntax of the GATC has to be exact for this to work. When in place, your Traffic Sources > Search Engine report will look something like the one below:
If you use this hack, I would be interested to hear want you think, so please add your comments below or provide a rating by clicking the stars.
© Brian Clifton for Measuring Success, 2009. |
Permalink |
40 comments |
Add to
del.icio.us
Post tags: cusomise, customize, local, regional, search engines