Don’t bother Firefox users with AdSense Firefox Referrals

Since I can finally use Firefox Referrals within Google Adsense, too, here’s a quick tip for those who put the ads on their sites, but forgot that not everyone needs Firefox (e.g. those who installed it already and are viewing your site with it :D).

If you run WordPress for example, you can quickly insert this PHP code to show the Firefox ad just to those using not Firefox:


<?php
if(strpos(@$_SERVER['HTTP_USER_AGENT'],'Firefox') === FALSE) {
?>
<script type="text/javascript"><!--
google_ad_client = "pub-4253783154304212";
google_ad_width = 120;
google_ad_height = 60;
google_ad_format = "120x60_as_rimg";
google_cpa_choice = "CAAQ2eOZzgEaCD4zuVkdzt_CKI-293M";
//--></script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
<?php
}
?>

If you want to show something else when the user is using Firefox (for example an AdSense banner):


<?php
if(strpos(@$_SERVER['HTTP_USER_AGENT'],'Firefox') === FALSE) {
?>
<script type="text/javascript"><!--
google_ad_client = "pub-4253783154304212";
google_ad_width = 120;
google_ad_height = 60;
google_ad_format = "120x60_as_rimg";
google_cpa_choice = "CAAQ2eOZzgEaCD4zuVkdzt_CKI-293M";
//--></script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
<?php
}
else {
?>
<script type="text/javascript"><!--
google_ad_client = "pub-4253783154304212";
google_ad_width = 234;
google_ad_height = 60;
google_ad_format = "234x60_as";
google_ad_type = "text";
google_ad_channel ="";
google_color_border = "F4F4F4";
google_color_bg = "FFFFFF";
google_color_link = "142A3B";
google_color_url = "142A3B";
google_color_text = "000000";
//--></script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
<?php
}
?>

You can use the code above directly, or replace it with your own so you actually earn the money.

Published by

Julian Bez

Julian Bez

Julian Bez is a web developer, entrepreneur, and founder from Berlin, Germany.

  • http://www.seweso.com/ seweso

    The idea is that when someone already has firefox he/she will install the google toolbar! So the link is not useless for firefox users.

  • http://techticker.blogspot.com kunal

    but isnt it mentioned in their TOS that nothing should be fiddled within the code. and if its legal can this be applied to blogger blogs?

  • Pingback: The Future Of The Web()

  • http://www.julian-bez.de/ Julian

    @seweso: You don’t get money if the user has already Firefox installed.

    @kunal: The code is modified in no way. So no problem here.

  • http://www.jokesinn.com Usman

    thanks buddy!