Now You Can Download Google Chrome OS for Free!
 

Showing the Adsense Firefox Referral Button to Non-Firefox Visitors

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

advertisement

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.

Read also:

  • 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".
  • i am using that too. but I put the advantages of firefox too! open my page using IE to see them
  • hey/. realy nice idea.. thx man..
  • Yes Lcf......nice idea.
  • 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
  • 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 ;)
  • Strange, but it is displaying the ad in Firefox too. :lol:
  • This one I'll use on my blog.
blog comments powered by Disqus