Friday, July 10, 2009

Google Image traffic - transferring from Referral to Organic

It is very vital for Website owners to track the number of users who have visited their website through an image search. Currently all traffic that is generated through image searches are shown as referrals. Hence we cannot track the keyword information associated with the users’ image search.

In order to shift this traffic medium from referral to organic, all you need to add is add this additional code which is highlighted in bold.

<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "' type='text/javascript'%3E%3C/script%3E"));
<script type="text/javascript">
try {
var pageTracker = _gat._getTracker("UA-xxxxxxx-x");
pageTracker._addOrganic("google", "prev");
} catch(err) {}

After the code has been modified, the next thing you need to do is go to your Google Analytics account and do the following.

Click on Filter Manager and fill these details under Create New filter.

Filter Name: Put a name that is easily identifiable or associating to the tracking. E.g.: Google Images
Filter Type: Select "Custom Filter" & Click on "Advanced"

Field A -> Extract A: Select Campaign Term and punch in the following values in the next column "/images?(.*)(q|p)=([^&]*)"
Field B -> Leave this field empty
Output To -> Constructor: Select "Campaign Term" and type image search $A3 in the next column.

Field A Required - Yes
Field B Required - No
Override Output Field - Yes
Case Sensitive - No

Select the website profile on which you would like this filter to be applied and click on "Save Changes".

That’s it. You will now be able to track visits received through images in organic and the keyword information associated with the visitor’s image search.

I hope this information has helped you guys. Cheers!


kroonoverdrive said...

Awesome, I already had the code on my site but I didn't know how to setup GA's filter settings. Thanks!

Beno John said...

Welcome Kroonoverdrive!

Dan said...


This solution has stopped working in May 2010. If anyone knows how to fix it, it would be greatly appreciated.


Adarshyam Vontivilu said...

Beno John, is there any ways to track the google search term for my webpage?? you showed it for image search term but I want it for web search.. thanks.

Beno John said...

Dan - sorry for this late reply. I haven't been active on the blog for quite sometime.
I had faced similar problem and received help from Brian.
The reason for this is Google has changed the domain structure for image search. It has moved from to
You would start receiving image traffic details in organic search by just making a small change to the tracking code and the filter. I have edited and updated them in this post.

Beno John said...

Adarshyam - if you have installed google analytics correctly, then the web search terms would be available in the reports provided by them. You will find them under "Traffic Sources".