Well its pretty much all in the title - I just want to have my ads showing 50% of the time, and someone elses ads showing 50% of the time - how? I don't understand why this isn't working. My first thought was to try this: (By the way, I'm really a bit clueless when it comes to JavaScript, so bear with me!) <script type="text/javascript"> var r=Math.random() if (r>0.5) { <script type="text/javascript"><!-- google_ad_client = "pub-1472271703469017"; google_ad_width = 160; google_ad_height = 600; google_ad_format = "160x600_as"; google_ad_type = "text_image"; google_ad_channel = ""; google_color_border = "FFFFCC"; google_color_bg = "FFFFCC"; google_color_link = "6F3C1B"; google_color_text = "6F3C1B"; google_color_url = "6F3C1B"; //--> </script> <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script> } else { <script type="text/javascript"><!-- google_ad_client = "pub-8905391473999593"; google_ad_width = 160; google_ad_height = 600; google_ad_format = "160x600_as"; google_ad_type = "text_image"; google_ad_channel = ""; google_color_border = "FFFFCC"; google_color_bg = "FFFFCC"; google_color_link = "6F3C1B"; google_color_text = "6F3C1B"; google_color_url = "6F3C1B"; //--> </script> <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script> } </script> HTML: I did spot several possible flaws in this, including the inclusion of the script tags and the (")'s that should perhaps have been (')'s, but no matter which variation I use, I cant suss it. Then I tried to change the publisher ID to a variable, and use: if (r>0.5) { var pubID = ***My Publisher ID*** } else { var pubID = ***My Partners Publisher ID*** } HTML: Again - no luck. So please - I am tearing my hair out over this one - does anybody have the solution? Thanks very much
You'd better use server side scripting, I'm telling you to do that because IMO you can't do that with JavaScript without modifying the AdSense code (not allowed) BTW: Nesting javascript doesn't work
Indeed; use server side scripting. All revenue sharing solutions are using server side scripting like ASP or PHP.