Google Analytics and Google Image search: revisited
I wrote earlier about using a custom urchin.js to get Google Analytics to extract the keywords from Image Search. Now my colleague Roy recently spoke about this with an engineer from Google, and this engineer suggested that I could just rewrite the one function and add that as an extra javascript instead of using a completely custom urchin.js. This is, of course, way more preferable, because it saves quite some bandwidth, and you won't have to update every time Google updates it.
What you have to do is this:
[sourcecode language="jscript"]
[/sourcecode]
The custom_se.js adds the extra image search engines amongst other things, so you can see stuff is coming from image search. Otherwise the hits would be counted as "plain" Google. The track-imagesearch.js rewrites the _uInfo function, and makes sure Google "get's" it's own image search parameters.
You can download the two zipped together: Track Image-search Scripts.
Related posts
- Getting Google Analytics to extract keywords from Google Image searches
- Google Analytics: adding search engines
- Image search keyword tracking with the new Google Analytics
- Google Analytics: Adding search engines in the new version
- Google Analytics for WordPress: my latest plugin













webdesign Sep 7th, 2007 at 13:27
This is indead a much better approach to the script !
thx for the tip cause this saves a lot of editing work when google updates !
keep up the good work and kick those Ba**ER*S of Dmoz for me :)
Joost de Valk Sep 7th, 2007 at 13:34
The WordPress plugin I'm building which supports this is nearing completion to, testing that with a few people now.
webdesign Sep 7th, 2007 at 14:23
ok good to hear that !
i dont use wordpress for myself but i come along it way to often to let such a plugin uninstalled :)
Avinash Kaushik Sep 8th, 2007 at 01:03
Joost,
This is a very elegant solution!
Thanks so much for putting this out there for the good of all us analytics practitioners! :)
-Avinash.
John Stevens Sep 8th, 2007 at 22:11
Joost, thanks to share this with us. What is more important to you? To know what really comes from the plain search (so filter out the image search) or to find out how many users and via what keyword visitors ends on your website?
Personally I don't give much attention to Google Image search... should I do that ? Maybe your tool can convince me.
DennisG Sep 9th, 2007 at 16:34
Joost,
Thank you very much.
Through Mybloglog I already know that image search is a big part of my search engine traffic. Now, getting it consolidated in Analytics makes a lot of sense.
Does this mean that you can tweak the track-image.js for other search engines from Google.
Blogsearch.Google comes to mind here.
Thanks
Dennis
Joost de Valk Sep 9th, 2007 at 20:04
Yeah Dennis, it does :) In fact, adding blogsearch is probably a great idea.
Rhoda Schueller Sep 9th, 2007 at 21:24
Hi,
I want to thank you for your method to track image searches. I added the original files with added images engines like Yahoo and Ask. A few others too though I have not seen much from the others. Yahoo has sent traffic for images. I would like to try your new file out that is specifically for Google image searches. However, will it cause problems with the Yahoo image searches? Or will it just process the Google image searches and not affect any of the other engine image searches?
Thanks,
Rhoda
Joost de Valk Sep 9th, 2007 at 21:27
@Rhoda: it will not affect any of the other engine image searches.
glamcars Oct 12th, 2007 at 11:29
I`ve just installed this plugin and waiting results. I have one question - is google-analytics system updates every domain once per day? I`ll be very happy if it`ll make this even twice per day... Thanks a lot for plugin
Joost de Valk Oct 12th, 2007 at 11:43
It's once a day yeah.
George Oct 18th, 2007 at 09:53
One quick tip for us part-time coders out there: make sure you change, in the code above, the "www.example.com" to your own domain! I noticed my stats were dropping off and I finally went back and looked at the code - I realized I never updated the example.com text to my own domain!
I made some other mistakes that hurt my Google Image search in general (not sure exactly why, but I read somewhere that when 301 redirecting you should leave the old content up for a few months, which I didn't do - I thought that was what the redirect was there for).
I am hoping that renaming the image files and pages was what hurt my image search results, and that they will eventually be reindexed. I wish I would have found your mod_rewrite for underscores to dashes first! I did need to rename some files anyways.
I guess when you learn this way you never make those mistakes twice!
Joost de Valk Oct 18th, 2007 at 09:54
@George: "I read somewhere that when 301 redirecting you should leave the old content up for a few months, which I didn't do - I thought that was what the redirect was there for)."
You were right and what you read was NOT true.
George Oct 18th, 2007 at 10:05
Thanks for that info!
Now I wonder what I did to cause all my images to drop out of the Google Image search results.
Blog images are fine (blog is in a subdirectory of my main site), but all the images from my main portfolio site are no longer in GIS when they used to be on the first page for the same keyword searches.
The hunt goes on I guess. Thanks again!
Domus Nov 21st, 2007 at 18:37
Thank you very much!
Mitico Dec 8th, 2007 at 11:19
I have included your scripts but Analytics continues showing images.google (referal). Any idea?
homicidal Dec 19th, 2007 at 19:16
hi Joost,
An excellent script, I read it this morning and set it up today, and already am I seeing the hits coming from image searches enter in the 'search engines' section rather than the 'referring sites' section, which makes everything a lot more clearer (ie bounce rates, exit rates are generally higher for image searches). I run a small NSFW-ish blog :P with a lot of celebrity images so I attract a lot of image search hits.
Amazing actually that Google sofar hasn't put this functionality standard in Analytics, they should take your script and give you credit for it!
Thanks again, a new big fan of your blog! (counts as a conversion! :)
Kristjan Jan 16th, 2008 at 19:09
Hi,
All these improvements are great, but could you tell
the visitors if all this works with new google tracking code at the start with red color or something. Saves a lot of buzz.
Does your image search work if I change search engine list according to ga.js
pageTracker._addOrganic("search_engine_name","query");
Cheers
Kristjan
Rhoda Jan 17th, 2008 at 02:22
Hi,
I would like to say that I converted one web site to the new ga.js for Google Analytics. I also converted the custom_se.js file listing the search engines. I now see images.google.com but only as a referral. Clicking on the listing does not lead me to the keywords as it does with the organic listing for images.google.com in the old system with the urchin.js. In the old system I also have image listings from other engines too all called organic which will lead to keywords by clicking on the organic listing.
Not sure what the problem is.
Rhoda
webdesign Jan 20th, 2008 at 13:32
i tried the code as well !! it worked fine ! you can see every referer !! i even added a few of my own.
Eoghan Feb 19th, 2008 at 20:32
Joost, Thanks for making this script available. I have been using it for several months now. As I am going through an effort to reduce the size of my website I ran the 9kb custom_se.js script through the compressor at http://javascriptcompressor.com/ and the compressed version is just over 50% smaller. Do you know if there would be any problems with this smaller version? Would it work as the original version?
Joost de Valk Feb 19th, 2008 at 20:33
Eoghan: it would probably work just as well! There's a lot of whitespace etc. in the file...
Eoghan Feb 19th, 2008 at 20:43
Joost, thanks for the quick reply. If it was only white space removal I would be fully confident however it also obfuscates the Javascript code, hence my doubt. Do you think that the obfuscating would make it work any different? A quick look at the code the compression tool pumps out might give some indication, unfortunately I don't have the javascript knowledge to make such a call...
Joost de Valk Feb 19th, 2008 at 20:45
By it's nature, obfuscated code is hard to read ;) Can't you just minimize it and NOT obfuscate it?