Forum Moderators: open

Message Too Old, No Replies

Serving AdSense only for Netscape browsers

         

rokec

12:00 pm on Jan 20, 2007 (gmt 0)

10+ Year Member



I'm using AdSense Referrals. I want to show this:

<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>

only if navigator.appName="Netscape".

Thanks in advance.

StupidScript

8:15 pm on Jan 22, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Bust it up:

<script type="text/javascript">
var isnav=(navigator.appName=="Netscape")?1:0;
if (isnav) {
document.write('<' + 'script');
document.write(' type="text/javascript"');
document.write(' src="http://pagead2.googlesyndication.com/pagead/show_ads.js"' + '>');
document.write('</' + 'script' + '>');
}
</script>

whoisgregg

2:19 pm on Jan 23, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Be aware that modifying the code provided by Adsense is a violation of the TOS and could get you in trouble. You can do targeted delivery using server side technology (PHP, etc.) but you can't mess with the code they give you.

StupidScript

10:53 pm on Jan 23, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Is my example modifying the code, or merely the way it being delivered? In the end, it's the same code without modifications, as far as the browser is concerned, isn't it?

I am curious...

abbeyvet

10:58 pm on Jan 23, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



It isn't modifying the code - as you say it is just a method of delivery. There is no issue that I can see that relates to the TOS.

People rotate google ads with other ads and other content all the time - the code is intact, it's a non-issue.

With the usual "to be certain ask Google....." proviso of course, though quite honestly I think they must be sick of answering this sort of question when it is obviously not relevant.

whoisgregg

2:41 pm on Jan 24, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



People rotate google ads with other ads and other content all the time - the code is intact, it's a non-issue.

People rotate google ads with other ads using server-side scripting which is allowed. In those cases, a Google employee would always be able to validate, when it appears, the adsense code on the page source to valid code provided by Google. I wouldn't depend on the person doing a hand check to understand javascript enough to realize that this modification has the same practical effect as using server side user agent sniffing.

Basically, I understand the TOS to be that the code they provide must be copied and pasted without modification. Splitting it up into a handful of document.write statements would be modification -- even though the modification has no effect on the functioning of the code. I'd definitely ask Google if you choose to proceed with this approach.

If you'd like to use PHP to target your delivery, you could use something like this:

<?php
if( strpos($_SERVER['HTTP_USER_AGENT'], 'Netscape') !== false){
echo '<script...></script>';
}
?>

rokec

11:35 am on Jan 28, 2007 (gmt 0)

10+ Year Member



Thanks, I used php code to do this job. I have read that php header information isn't always accurate, because some firewals and browsers are protecting header information to be sent.