Hi guys. i have signed up google adsense and i’m using their referral adverts for firefox and picasso but i only want to display one referral at a time on a page. I don’t see much point in advertising the firefox referral to users who are already viewing the page using firefox so is it possible to write some JS which will only display the firefox referal to users of non firefox browsers and that will also display both the firefox and picasso referrals to all other users (IE/Safare/Netscape/Opera)
I’m currently using an If/Else statement
[code=html]
<SCRIPT language=”JavaScript”>
<!–
google_ad_client = “pub-7213854248425086”;
google_ad_width = 125;
google_ad_height = 125;
google_ad_format = “125x125_as_rimg”;
google_ad_channel = “”;
src=”http://pagead2.googlesyndication.com/pagead/show_ads.js”;
if (navigator.userAgent.indexOf(“Firefox”)!=-1) {
google_cpa_choice = “CAAQ6OGIlAIaCFN_N8Za4RF6KITHrYMB”;
} else {
google_cpa_choice = “CAAQveHnzwEaCEiH5iXPqf1SKJe193M”;
}
–>
<script type=”text/javascript”
src=”http://pagead2.googlesyndication.com/pagead/show_ads.js”>
</script>
The code above works fairly well.
Firefox users -> Picasso Ad (no Firefox Ad)
IE/Opera users -> Firefox Ad
However i want to be able to disable the Picasso Advert to IE users as well as the Firefox Advert. I was thinking the best way to do it would be to create an array of 2 and store the google_cpa_choice value within the array. Then use a random funtion on the array to disable the values if the user is using IE.
My JS isn’t the best though, and the attempts i have made have being horrible. Could someone provide me with a few pointers?
[code=html]
var iearray = new Array(2)
iearry[0] = “google_cpa_choice = “CAAQveHnzwEaCEiH5iXPqf1SKJe193M”
iearry[1] = “google_cpa_choice = “CAAQ6OGIlAIaCFN_N8Za4RF6KITHrYMB”
//code
//code
else {
google_cpa_choice = document.write(iearry) //random
}
^ this is in no way correct but is a bit pseudocode-esque on what i want to accomplish.