Google Analytics Search Engine Extension

Posted 2009-06-23 in JavaScript by Johann.

Google Analytics comes with its own list of search engines

Unfortunately, Google is missing many smaller search engines, as well as local versions of certain search engines.

By default, Google Analytics’ JavaScript supports the following search engines: Daum, Eniro, Naver, images.google.com, Google, Yahoo, MSN, Bing, AOL, Lycos, Ask, Altavista, Netscape, CNN, About.com, Mamma, Alltheweb, Voila, Virgilio, Live, Baidu, Alice, Yandex, Najdi, Mama, Seznam, Search.com, Szukaj, Onet, Szukacz, Yam, PCHome, Kvasir, Sesam, Ozu, Terra, MyNet, Ekolay and Rambler.

The following JavaScript adds support for 60 70 sites to Google Analytics, among those caching domains (bingj.com), social web search engines (IceRocket, Twitter, Technorati) and many ISP portals.

// Extends Google Analytics with a ton of smaller search engines for more accurate search tracking.
// Written by Johann Burkard mailto:johann@johannburkard.de <https://johannburkard.de>
// MIT license.

for(var e="abcsok,alot,aolsvc,auone,babylon,bigseekpro,bingj,blingo,blogsearch.google,charter,comcast,conduit,cuil,com.com,daemon-search,dir.mobi,duckduckgo,earthlink,friendfeed,home.nl,icerocket,icq,incredimail,info.co.uk,mail.ru,metager2,mycricket,mytelus,nifty,ninemsn,oneview,orange.co,peoplepc,reddit,reference,semager,startpagina,sweetim,t-online,twitter,uluble,vinden,virginmedia,wibeez+q|ixquick,netzero,qip.ru,tiscali+query|att.net+string|orange.es+buscar|aliceadsl,rr.com+qs|alicesuche,gougou,technorati+search|avantfind+Keywords|mister-wong+keywords|delicious+p|info.com+qkw|sky+term|myspace+qry|gmx,web.de+su|soso+w|ukr.net+search_query|opendns+url|baidu,niuhu+bs|baidu,niuhu+word".split("|"), l=e.length;l--;)for(var p=e[l].split(/[,+]/),k=p.length-1,m=k;m--;)pageTracker._addOrganic(p[m],p[k]);

To use the Google Analytics search engine extension, insert the following line before the call to _gat._getTracker:

<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">
try {
var pageTracker = _gat._getTracker("XXX");

for(var e="abcsok,alot,aolsvc,auone,babylon,bigseekpro,bingj,blingo,blogsearch.google,charter,comcast,conduit,cuil,com.com,daemon-search,dir.mobi,duckduckgo,earthlink,friendfeed,home.nl,icerocket,icq,incredimail,info.co.uk,mail.ru,metager2,mycricket,mytelus,nifty,ninemsn,oneview,orange.co,peoplepc,reddit,reference,semager,startpagina,sweetim,t-online,twitter,uluble,vinden,virginmedia,wibeez+q|ixquick,netzero,qip.ru,tiscali+query|att.net+string|orange.es+buscar|aliceadsl,rr.com+qs|alicesuche,gougou,technorati+search|avantfind+Keywords|mister-wong+keywords|delicious+p|info.com+qkw|sky+term|myspace+qry|gmx,web.de+su|soso+w|ukr.net+search_query|opendns+url|baidu,niuhu+bs|baidu,niuhu+word".split("|"), l=e.length;l--;)for(var p=e[l].split(/[,+]/),k=p.length-1,m=k;m--;)pageTracker._addOrganic(p[m],p[k]);

pageTracker._trackPageview();
} catch(err) {}</script>

If you are serious about keyword statistics and data mining, give it a try. Please email me if you have additions or comments.

Subscribe

RSS 2.0, Atom or subscribe by Email.

Top Posts

  1. DynaCloud - a dynamic JavaScript tag/keyword cloud with jQuery
  2. 6 fast jQuery Tips: More basic Snippets
  3. xslt.js version 3.2 released
  4. xslt.js version 3.0 released XML XSLT now with jQuery plugin
  5. Forum Scanners - prevent forum abuse
  6. Automate JavaScript compression with YUI Compressor and /packer/

Navigation