SEO Tracking – Customising the list of recognised search enginesGoogle Analytics specific, Plugins & Hacks
[This hack is for the legacy urchin.js tracking code. For the ga.js version read: Customising the list of search engines in Google Analytics.]
April 2011 – New async hack launched
This hack has been completely revised for the latest GA async code. Further info >>
Google Analytics shows which search engine your visitors/customers have used in the Traffic Sources > Search Engines report. To view the list of all the search engines that Google Analytics currently identifies by default, simply load into your browser http://www.google-analytics.com/urchin.js. In this file you will see the section commented as:
//-- Auto/Organic Sources and Keywords
This section is where the organic search engines are defined that once captured by the Google Analytics Tracking Code (GATC) will be reported in the reports interface. By looking at this section, you will notice that the current number of organic search engines detected by default is 28 i.e.
Of course Google recognises that there are a great deal more search engines in the world – language and regional specific as well as niche search engines such as price comparison and vertical portals. It is therefore possible to modify and append the array of recognised search engines and there are two methods.
1. The standard method of adding additional search engines to GA
Add the following code to your page GATC:
The value for
_uOsr is the domain name (sub-domain or part of the domain to match) of the search engine and the value for
_uOkw is the query variable which stores the keyword (replace search_engine_name and query_variable in the example above).
The number in square brackets should start at 28, or one more than what ever the last number is if the number has been updated, and increase in increments of 1 for each additional search engine added (29, 30, 31, etc).
For example, if someone searched for “motorcycle” and the search result URL is:
you would add the following line to your tracking code on your pages:
Another example where this technique is useful is to add price comparison engines as a regular search engine:
By this method, Kelkoo would be listed in the Search Engine Marketing report along side other search engines. That is useful in itself, but what provides more insight is the corresponding Kelkoo search terms used by visitors will also be listed in the Keywords report. Without this little hack, Kelkoo would simply be listed as a standard referrer and no search terms would be logged.
Apart from adding additional search engines to the existing list provided by Google Analytics, you could also use this method to create more regional ones of the main players. For example, if you are based in the UK, being able to differentiate google.co.uk from google.com may be of importance. In which case you would add the following to your GATC of each page:
Note: When adding regional variations to the search engine list, the order or the
_uOkw arrays become important. So google.co.uk must be listed before the “catch-all” match of google. That of course requires the re-numbering of the search engine list array.
2. A more robust method…
This script overwrites the default search engine array of Google Analytics and uses the array length (
_uOsr.length) to increment its index so that re-numbering is not required when adding new entries. A sample of the code is provided below:
var _uOsr=new Array(); var _uOkw=new Array(); // Google EMEA Domains _uOsr[_uOsr.length]="google.co.uk"; _uOkw[_uOsr.length]="q"; _uOsr[_uOsr.length]="google.es"; _uOkw[_uOsr.length]="q"; _uOsr[_uOsr.length]="google.pt"; _uOkw[_uOsr.length]="q"; _uOsr[_uOsr.length]="google.it"; _uOkw[_uOsr.length]="q";… etc.
So by this method, you simply maintain a separate file for your list of search engines and you don’t need to worry about renumbering each time you update/append. Feel free to use the script directly from this site (as shown in the example), or download and host it locally.
Many thanks for the guys at GA-Experts.com for the help with building and testing the custom_se.js file.
Did you find this tip useful? All tips are being grouped under the category GA Hacks. Please provide your feedback with a comment.