Forum Moderators: martinibuster
if true...
google_ad_client = "---";
google_ad_width = 468;
google_ad_height = 60;
google_ad_format = "468x60_as";
google_ad_type = "text";
google_ad_channel ="";
google_color_border = "9DADC6";
google_color_bg = "FFFFFF";
google_color_link = "0000FF";
google_color_url = "008000";
google_color_text = "000000";
var x = document.createElement("script");
x.src = "http://pagead2.googlesyndication.com/pagead/show_ads.js";
document.body.appendChild(x);
Although script element is added to DOM browsers don't show nothing. Any suggestions?
However, you are not allowed to change the Adsense code itself. That is against the TOS.
e.g.
if ( $your_boolean_variable == true) {
echo $AdSense_code_in_this_string;
}
You could expend the code to add whatever you like or even add an ELSE clause that uses alternative code to fill the space that AdSense would have taken up.
That violates the TOS. You are modifing the code!
Can't use server side stuff, need to detect plug-in and if it is not present display also ads (there is lot of empty space in this case) This is mainly for IE users who are reluctant to install plug-in I'm currently using.
<!--[if IE]>
adsense code here
<![endif]-->
Using something like PHP to write out the code conditionally is OK because the end result is indistinguishable from cut-and-pasted code to any browser or spider.
if (var == true)
{
google_ad_client = "---";
google_ad_width = 468;
google_ad_height = 60;
google_ad_format = "468x60_as";
google_ad_type = "text";
google_ad_channel ="";
google_color_border = "9DADC6";
google_color_bg = "FFFFFF";
google_color_link = "0000FF";
google_color_url = "008000";
google_color_text = "000000";
}
<script src="googlesyndication js file"></script>
I dont know whether its against TOS or not.
Milan
<!--
google_ad_client = "---";
google_ad_width = 728;
google_ad_height = 90;
google_ad_format = "728x90_as";
//--></script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
//-->
and then was called with
<script type="text/javascript" src="google.js"></script>
(If I choose to use this method I would write this part with javascript)
Apparently this only works with IE, but thas enough.
At least [webmasterworld.com...]
says:
Its acceptable.An email from their support.
Thank you for your email. Placing the AdSense code within a .js file is acceptable so long as there is no alteration of the AdSense code itself.
We realize that this makes the AdSense code much easier to maintain across an entire website.
App is coded with PHP so I can try Cookie approach.
Just need to figure out what to do with first time users. Maybe it is best to shows ads by default and stop only when cookie states that plug-in is installed.