My First Car, Honda City 2009
 

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:
  1. <?php if ( !strpos($_SERVER['HTTP_USER_AGENT'], 'Gecko') ) { ?>
  2. <!-- PASTE YOUR GOOGLE ADSENSE FIREFOX REFERRAL CODE HERE -->
  3. <?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.

Bookmark and Share

Read also:

What do you think? 10 Responses to “Showing the Adsense Firefox Referral Button to Non-Firefox Visitors”

Comments Feed | TrackBack URL
  1. #1
    Patrick Says:

    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.

  2. #2
    LcF Says:

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

  3. #3
    korokmu Says:

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

  4. #4
    mr.eims Says:

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

  5. #5
    Home Tuition Malaysia Says:

    Yes Lcf……nice idea.

  6. #6
    stchatterbox Says:

    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

  7. #7
    TLB Says:

    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 ;)

  8. #8
    Show Firefox Referrals to IE users only Says:

    [...] Firefox user, so what’s the point in showing that to me? Solution: I came across a neat trick by LiewCF which detects all non-Firefox users. His trick worked by recognizing all non-gecko browser, so it [...]

  9. #9
    NSpeaks Says:

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

  10. #10
    David Jacques-Louis Says:

    This one I’ll use on my blog.

Comments are closed. Submit your comment here