SEO Tracking – Customising the list of recognised search engines

GA HacksMy standard word of caution – This is a tech tip and requires you to have a knowledge of html and javascript to implement and use it…

[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 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. _uOsr[0] to _uOsr[27].

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 from 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 _uOsr and _uOkw arrays become important. So 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…

An example of a more complete and robust method of adding additional search engines to the list is shown at: In this case, the list of custom/localised search engines is kept in a separate JavaScript file and referenced in each page within the GATC as follows:

// custom_se.js must be called after urchin.js

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]="";	_uOkw[_uOsr.length]="q";
_uOsr[_uOsr.length]="";	_uOkw[_uOsr.length]="q";
_uOsr[_uOsr.length]="";	_uOkw[_uOsr.length]="q";
_uOsr[_uOsr.length]="";	_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 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.

Looking for a keynote speaker, or wish to hire Brian…?

If you are an organisation wishing to hire me and my team, please view the Contact page. I am based in Sweden and advise organisations in Europe as well as North America.

You May Also Like…

Sayonara Universal Analytics

Sayonara Universal Analytics

My first Google Analytics data point was 15th May 2005 for UA-20024. If you are of a certain age, that may sound off...


  1. Tomas Kapler

    first let me tell you, that your book is great (got it in czech)

    About this – i’m using a variant of this (with local search engines) but i got a problem that one of very important search engine here rewrites the urls, so it is e.g. instead of
    I’m wondering how to solve it to show it in the report – i wondered about changing the referrer using regexp before calling analytics, but it is afaik read only value (for javascript). I think it should be possible using changing utmr parameter, but there is no public function for doing this. What would you recommend?

    • Brian Clifton

      Tomas: thanks for the feedback. Your issue sounds very familiar to one I looked at a year or so ago. I was trying to identify search queries from Technorati that has a similar rewrite. To cut a long story short, I could not get it to work.

      You will not be able to manipulate the referrer string as this is a built in security feature of browsers to stop spoofing. I also don’t recommend hosting the GATC locally and changing the code of utmr. Google has a monthly update cycle for the GATC, so keeping your own customised version up to date will be a nightmare for you!

      Have you tried some of the filter ideas I have posted on recently?

      A modification of these could be used to relabel your referrer to something else. Note, labelling as organic search will not work as that takes place before filter processing, but you could label it as something else.

      Let me know how you get on.

  2. Business Email List

    Very useful post How about adding google custom search engines to website.

  3. Paul Mycroft

    Hi Brian,

    Why do I get a JavaScript error when installing the custom_se.js for GA file in the root?

    “pageTracker is not defined”

    However, I don’t get the error when installing the custom_se.js file for urchin.js.

  4. Eamonn Mc Greevy

    Hi Brian,

    I’m a little frustrated in that I can’t yet benefit from your script. Is it still working for you?

    It should be a simple thing to implement but I’m not getting any results, eg, coming through. I can see that the script is downloading but I can’t see if it has overwritten the urchin script. The custom_se.js is in the root of my site and I’ve added the reference below the urchin script line:

    Any input would be appreciated.

  5. Brian Clifton

    Good question Eamonn…

    If the site were down, the browser may generate an error, but since it’s located in a separate script block, it shouldn’t affect other js from running. So yes, the default should work. However please test and let us know if that is the case.

  6. Eamonn Mc Greevy

    Many Thanks Brian,

    This will be very handy. Just a question on the the 2nd method; if the custom_se.js was stored on my web developers site and it went offline, I guess the default urchin.js would work as normal?

  7. 3rdincome

    Very helpful. What about adding Google Maps? Can you differentiate the Maps vs. normal Google search? Thanks!

  8. Brian Clifton

    Sebastien: Changing the array order will make no difference to the historical data as this information is only used once during processing.

    Of course, historical data may be reprocessed by Google but this is very rare – for example it happened when the latest version of GA was released in May.

  9. Sébastien Brodeur

    What happened if after sometime you change the array order? Will the data be wrong if I look back in time?


Submit a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Share This