|
|
|
|
![]() ![]() |
Jun 7 2006, 08:04 PM
Post
#1
|
|
|
Member [Level 3] ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 98 Joined: 17-April 06 Member No.: 22,018 |
If you are like me, you have a Google AdSense account. You would like to get more product referrals for Firefox, wouldn't you?
I wrote some PHP script that will either displays the Google - Firefox Referral" banner to non-Firefox users or your "Google AdSense for content" banner. If you didn't know, I believe that you only get product referrals for Firefox when a non-Firefox user downloads and installs the program - the target audience is non-Firefox users. This smart script never displays the Firefox referral to Firefox users, but shows the Google AdSense for content ads. Important: you must configure the parts in the code below to match your google <script> HTML block that you get when you access your Google AdSense account. Also, be notified that all double-quotes have been changed to single-quotes in the separate "echo" blocks. CODE <?php // SET THESE VALUES!! $yourpub = "pub-################"; $colborder = "2F5F91"; $collink= "4040DD"; $col_bg = "F0F2F7"; $coltext = "3F3F3F"; $colurl = "008000"; $browserinfo = $_SERVER['HTTP_USER_AGENT']; if ( strpos($browserinfo, 'Gecko') ) { if ( strpos($browserinfo, 'Netscape') ) $nonfirefox = 'YES'; else if ( strpos($browserinfo, 'Firefox') ) $nonfirefox = 'Mozilla Firefox (Gecko/Firefox)'; else $nonfirefox = 'YES'; } else if ( strpos($browserinfo, 'MSIE') ) { if ( strpos($browserinfo, 'Opera') ) $nonfirefox = 'YES'; else $nonfirefox = 'YES'; } $showit = 1; // initialize to show the Google Ad if ( $nonfirefox == 'YES' ) { // change the second parameter below if you want to display the Firefox // product referral less frequently... shouldn't really exceed 10 or so... // change random calculation and any comparisons as needed $showit = rand(0, 3); if ($showit == 3) { // display the Firefox Product referral Ad, but give the user a small testimonial echo " <center> <small><font color='green'>I believe they do it better... and they are ahead of the curve.</font> <b>Download the latest version</b>.</small><br> </center> <script type='text/javascript'><!-- google_ad_client = '$yourpub'; google_ad_width = 468; google_ad_height = 60; google_ad_format = '468x60_as_rimg'; google_cpa_choice = 'CAAQtYiYhAIaCPydp1XAd3jZKOm293M';"; } } if ($showit < 3) { // display the Google Ad echo " <script type='text/javascript'><!-- google_ad_client = '$yourpub'; google_ad_width = 468; google_ad_height = 60; google_ad_format = '468x60_as'; google_ad_type = 'text_image'; google_ad_channel =''; google_color_border = '$colborder'; google_color_link = '$collink'; google_color_bg = '$col_bg'; google_color_text = '$coltext'; google_color_url = '$colurl';"; } // common ending for both blocks of Google Ad code echo " //--></script> <center> <script type='text/javascript' src='http://pagead2.googlesyndication.com/pagead/show_ads.js'> </script> </center> <br>"; ?> Of course, you should save this code as a separate unit - "googleads.php" and include it anywhere you want by using an include statement. CODE <?php include "googleads.php" ?>
|
|
|
|
Jun 7 2006, 09:20 PM
Post
#2
|
|
|
Premium Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 174 Joined: 25-February 06 From: Austin, TX Member No.: 19,113 |
Wow, this a very useful script. This is a great idea. I think that Google should do this by default, show the Firefox referral to browsers other than Firefox!
Thanks. |
|
|
|
Jul 1 2006, 10:39 PM
Post
#3
|
|
|
Newbie [Level 1] ![]() Group: Members Posts: 18 Joined: 1-July 06 Member No.: 25,903 |
Wow! That's a great idea! I might use it...
|
|
|
|
Jul 2 2006, 05:56 PM
Post
#4
|
|
|
Moderator ![]() Group: [MODERATOR] Posts: 1,337 Joined: 26-December 04 From: Canada Member No.: 2,940 |
Sometimes I just stick with the old javascript that redirects the user to getfirefox.com when they use IE
|
|
|
|
Aug 14 2006, 09:29 PM
Post
#5
|
|
|
Newbie [Level 2] ![]() ![]() Group: Members Posts: 25 Joined: 24-April 06 Member No.: 22,403 |
Aren't they only promotioning the toolbar? or the firefox download too?
This post has been edited by GrayFox: Aug 14 2006, 09:30 PM |
|
|
|
Aug 14 2006, 09:51 PM
Post
#6
|
|
|
Member [Level 3] ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 98 Joined: 17-April 06 Member No.: 22,018 |
Aren't they only promotioning the toolbar? or the firefox download too? I use a couple blocks of code now - so I have multiple google Adsense promotions handled in that code block. It randomly decides which promo to display. PM me if interested in a new sample of my code. |
|
|
|
Aug 14 2006, 11:19 PM
Post
#7
|
|
|
Trap Grand Marshal Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: [HOSTED] Posts: 1,314 Joined: 11-January 06 From: Chennai, India Member No.: 16,932 |
wow thats great code. Yhanx due. I was in need of it.
|
|
|
|
Aug 15 2006, 10:36 AM
Post
#8
|
|
|
The Ethical Hacker ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: [HOSTED] Posts: 1,171 Joined: 27-May 05 From: Portugal (Europe) Member No.: 7,566 |
Very interesting, original and usefull.
I will try this out, thanks for sharing with us this " "genius" php code" |
|
|
|
![]() ![]() |
Similar Topics