Over the past couple of years I’ve noticed something about referrals: Google Images is very very valuable in attracting users to your website, and because it’s a lesser-targetted area of search engine optimisation in general, it’s much easier to achieve high rankings in the image search results than it is in native search results.
The annoying thing about Google Images however, is the way it simply offers the image up to the viewer in a separate frame at the top of the screen, making it easy for visitors to simply steal/view your image directly and leave again without ever paying any attention to your site and potentially reducing your income if the site is monetised with advertisements. Google Images removes value and earning potential from your site whilst offering up your images for download for free.
I conducted a test about a year ago where I set a piece of JavaScript in the head of one of my websites (which was receiving particularly high hits from Google Image searches) that would ‘break away’ from the Google Images frame, removing it altogether and instead presenting the visitor with the website as it should appear (and removing direct access to the image):
<script language="JavaScript" type="text/javascript">
if (top.location != self.location)
top.location.replace(self.location);
</script>
You can see this script in action now by searching for site:pixelcounter.co.uk in Google Images and clicking on one of the images (or click on the link at the bottom of this post).
It works a charm and the really interesting thing was that visitors who would have originally been <5 second visitors sent a lot more time on my site. Not just cursing me under their breath whilst they tried to locate the image they wanted on the page, but clicking around, visiting other pages and on some occasions, actually even buying the item they had come searching for an image of! So it was an all-around success and quickly became a part of my standard development includes.
More recently there has been quite a lot of talk of these sorts of methods damaging your search rankings. I believe think that a fairly large proportion of the people reporting these issues just haven’t realised that it’s possible that this redirect technique will play tricks on your visitor statistics so although they’re no-longer seeing them as referrals from Google Images, that’s because of the redirection in the middle where the frame breaks out.
It’s also plausible that other variations of this same script break the visitor’s browser back button – a big no-no according to Google (the script above deliberately avoids this). There were even mumbles about Google seeing this sort of script as a common scam-type action and therefore were culling sites from their results because of that. Again, that boils down to manipulation of the user’s normal browser operation (the back button).
I haven’t seen a decrease in traffic to any of my sites as a result of using this script, even twelve and more months and more after implementing it, but just to be absolutely sure I do now take an extra precaution:
As I recently talked about in my post “Detect Visitors By Referring Address”, it is very easy to detect the referring URL when a visitor hits the site and treat them accordingly. In my example I redirected visitors to one of my sites who came from eBay pages to a notice about recent eBay scammers selling fake versions of my product, but it is just as easy to use these principles to inject the break-out script into the page source only when it is required.
Using the PHP code from my previous post, we detect images.google referrals:
< ?php
$referrer = $_SERVER['HTTP_REFERER'];
if (preg_match("/images.google/",$referrer)) {
?>
Next goes the JavaScript from above:
<script language="JavaScript" type="text/javascript">
if (top.location != self.location)
top.location.replace(self.location);
</script>
Doing it this way allows us to insert generic HTML or JavaScript into the condition without the need to use character escapes or echoes. And finally, we exit and close the function again:
< ?php
exit();
};
?>
And that’s it. Only people visiting from Google Images will end up with the break away script in the page source (and therefor will be broken out of the frames), and for any other visitor, the script will not exist in the source code at all, which most importantly (for the scaremongers who proclaim that breaking out of Google Images frames is a death move for your search engine rankings) means that if Google comes indexing the page they have absolutely no reason at all to suspect any spam-like activities (not that they should, but.. just in case) because they won’t detect the the script at all.
Credit to Stefan Juhl for the original frame breaking script
No Responses to “Break Out of Google Images Frames”