Forum Moderators: martinibuster

Message Too Old, No Replies

Will Frame Busting Code Cause Extra AdSense Impressions?

         

tebrino

10:32 pm on Oct 17, 2009 (gmt 0)

10+ Year Member



Lately some sites started to include my pages in frames in very annoying manner. I decided to get rid of this problem and found neat script that works fine:


if (top.location != self.location) top.location.replace(self.location);

My concern now is, will this artificially double AdSense impressions from people coming from those sites or break code in any other way? Anyone has any experience with this?

incrediBILL

10:37 pm on Oct 17, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



It will only double impressions if the page displays first including AdSense.

Make sure your frame buster code is in the top of the page, above the body, and it should redirect before the page displays.

tebrino

10:47 pm on Oct 17, 2009 (gmt 0)

10+ Year Member



IncrediBILL, thanks for your quick response. Yes, code is placed before AdSense code and indeed redirection happens before anything shows in browser. However, I created simple PHP session counter and placed it at the bottom of page. Every time I open framed page it shows me increment of two hits. Could it be possible JavaScript has time to execute too?

StoutFiles

4:55 am on Oct 18, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



PHP runs on your server, before the client side javascript is run. All PHP code is run before any Javascript is run so a PHP test is not useful in this situation.

IanCP

10:40 pm on Oct 18, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Anyone has any experience with this?

I've used similar code in the <head> section for yonks long before AdSense was invented.

I've never noticed anything.

tebrino

3:04 am on Oct 19, 2009 (gmt 0)

10+ Year Member



I did another test and added small Javascript code with alert function near the end of my test page. This was supposed to check is any code executed after redirection happens. Safari, Chrome and Opera showed two alerts while Firefox and IE showed only one on page load. This means that apparently some browsers seem to continue page loading even after redirection occurs and probably load AdSense or other ads too.

[edited by: tebrino at 3:45 am (utc) on Oct. 19, 2009]

tebrino

3:26 am on Oct 19, 2009 (gmt 0)

10+ Year Member



I did another experiment and added
window.stop();
after redirect code and it seems to work fine now. Final code looks like this:


if (top.location != self.location) {
top.location.replace(self.location);
if(navigator.appName == "Microsoft Internet Explorer"){
window.document.execCommand('Stop');
}
else{
window.stop();
}
}

That seems to stop browser from loading anything after that point