If you've been using Google Analytics for the last year and you've been creating good optimized Alt Text attributes for ALL of your images, you have probably seen increased traffic from Google images (especially for a photographer's website). However, we've not had any insight into what search terms the website viewer was using to get to the website. Well someone figured out how to modify the Google Analytics javascript that you put on all of your webpages to record page views in Google Analytics.
You need to substitute your website code in place of:
UA-xxxxxx-x
Below is the javascript to use:
<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" charset="utf-8"> try { var pageTracker = _gat._getTracker("UA-xxxxxx-x"); var ref = document.referrer; if (ref.search(/images.google/) != -1 && ref.search(/prev/) != -1) { var regex = new RegExp("images.google.([^\/]+).*&prev=([^&]+)"); var match = regex.exec(ref); pageTracker._clearOrganic(); pageTracker._addOrganic("images.google."+ match[1],"q"); pageTracker._setReferrerOverride("http://images.google." + match[1] + unescape(match[2])); } pageTracker._trackPageview(); } catch(err) {} </script>
The only problem is that this is not the latest Google Analytics script. I briefly tried to convert this to the new script but didn't have success. I searched on the web, but only found refers to this script. Thus I'd consider implementing it for image based websites where it is very important to track until there is new code.
RadEditor - please enable JavaScript to use the rich text editor.
I often get asked why I'm willing to journal all of my Sitefinity discoveries. People think I'm insane to give away for free what I labored over at some point.
Let me answer that in 2 parts:
Talk to us about how we can help YOU!
Keep up with our Sitefinity discoveries! Click on the RSS feed icon below or sign up for our newsletter.