Showing the Adsense Firefox Referral Button to Non-Firefox Visitors

Filed in: Adsense Tips, Make Money Online, Open Source, Web Development — February 23rd, 2006

There is no point showing the Firefox Adsense referral button to existing Firefox users. I used the following simple PHP code to show Firefox referral button to non-Firefox (Gecko) visitors only.

[php]
< ?php if ( !strpos($_SERVER['HTTP_USER_AGENT'], 'Gecko') ) { ?>

< ?php } ?>
[/php]

Simple huh? :)

Internet Explorer visitors see the Firefox referral banner
Internet Explorer visitors see the Firefox referral banner.

Firefox visitors do not see the Firefox referral banner
Firefox visitors do not see the Firefox referral banner

Bug?

I want to keep the code as simple as possible, therefore, it can not do deep browser detection. Safari (Mac OS X) users will be treated as Firefox users as well. :P

Here is the better PHP browser detection script, if you are interested.

Like this post? Please share:

Follow @liewcf on Twitter; Join Facebook page; Subscribe to free newsletter for updates like this article..

  • http://www.thteong.com/ Patrick

    A nice idea.
    But its only work in a site that got high traffic like yours.
    It will have more variety of user that using different browser.

  • http://www.thteong.com Patrick

    A nice idea.
    But its only work in a site that got high traffic like yours.
    It will have more variety of user that using different browser.

  • LcF

    my point is “don’t show firefox banner to firefox user”.

  • LcF

    my point is “don’t show firefox banner to firefox user”.

  • http://korokmu.eizil.com/ korokmu

    i am using that too. but I put the advantages of firefox too! open my page using IE to see them

  • http://korokmu.eizil.com korokmu

    i am using that too. but I put the advantages of firefox too! open my page using IE to see them

  • http://eims.daijoubu.org/ mr.eims

    hey/. realy nice idea.. thx man..

  • http://eims.daijoubu.org mr.eims

    hey/. realy nice idea.. thx man..

  • http://www.tuitionstudio.com/ Home Tuition Malaysia

    Yes Lcf……nice idea.

  • http://www.tuitionstudio.com Home Tuition Malaysia

    Yes Lcf……nice idea.

  • http://seville.oo.nu/blog stchatterbox

    this is so useful, i only have the detect IE script, and if i put it up, it seems I’m just pointing to those using IE. I hate opera so much

  • http://seville.oo.nu/blog stchatterbox

    this is so useful, i only have the detect IE script, and if i put it up, it seems I’m just pointing to those using IE. I hate opera so much

  • http://www.tiredlittlebunny.com/ TLB

    So long as it prompts IE users to download a more stable and ultimately awesome browser. Then I’m happy! Mac users already have decent browsing capabilities ;)

  • http://www.tiredlittlebunny.com TLB

    So long as it prompts IE users to download a more stable and ultimately awesome browser. Then I’m happy! Mac users already have decent browsing capabilities ;)

  • Pingback: Show Firefox Referrals to IE users only

  • http://nspeaks.com/ NSpeaks

    Strange, but it is displaying the ad in Firefox too. :lol:

  • http://nspeaks.com NSpeaks

    Strange, but it is displaying the ad in Firefox too. :lol:

  • http://www.moleskinsoft.com/ David Jacques-Louis

    This one I’ll use on my blog.

  • http://www.moleskinsoft.com David Jacques-Louis

    This one I’ll use on my blog.

t