Google Ads PHP Class


Hits: 2290  

Google AdSense: AdSense is an ad serving application run by Google Inc. Website owners can enroll in this program to enable text, image, and video advertisements on their websites. These advertisements are administered by Google and generate revenue on either a per-clickor per-impression basis.

<?php
/*
Normal Ad Unit:
728x90_as (Leaderboard)
468x60_as (Banner
)
234x60_as (Half Banner)
125x125_as (Button)
120x600_as (Skyscraper)
160x600_as (Wide Skyscraper)
180x150_as (Small Rectangle)
120x240_as (Vertical Banner)
200x200_as (Small Square)
250x250_as (Square)
300x250_as (Rectangle)
336x280_as (Large Rectangle)

Link Unit:
120x90_0ads_al (4 links)
120x90_0ads_al_s (5 links)
160x90_0ads_al (4 links)
160x90_0ads_al_s (5 links)
180x90_0ads_al (4 links)
180x90_0ads_al_s (5 links)
200x90_0ads_al (4 links)
200x90_0ads_al_s (5 links)
468x15_0ads_al (4 links)
468x15_0ads_al_s (5 links)
728x15_0ads_al (4 links)
728x15_0ads_al_s (5 links)

google_ad_client = “pub-XXXXXXXXXXXXXXXX”;
google_ad_width = 300;
google_ad_height = 250;
google_ad_format = “300x250_as”;
google_ad_type = “text_image”;
google_alternate_ad_url = “http://www.svnlabs.com/”
google_ad_channel = “XXXXXXXXXX”;
google_color_border = “FFFFFF”;
google_color_bg = “FFFFFF”;
google_color_link = “0000FF”;
google_color_text = “000000”;
google_color_url = “005577”;

*/

//Fill in Google Adsense Publisher ID.
$google_ad_client = “pub-XXXXXXXXXXXXXXXX”;
//Select Google Adsense Format to display
$google_ad_format = “468x60_as”;
//Fill in Ad Channel ID if you have one. Leave it blank if do not have.
$google_ad_channel = “”;
//Select Ad Type
$google_ad_type = “text_image”;
//Ad Border Color
$google_color_border = “FFFFFF”;
//Ad Background Color
$google_color_bg = “FFFFFF”;
//Ad Link Color
$google_color_link = “0000FF”;
//Ad Text Color
$google_color_text = “000000”;
//Ad URL Color
$google_color_url = “005577”;

switch ($google_ad_format)
{
case
‘728x90_as’:
$google_ad_width = 728; $google_ad_height = 90;
break;
case
‘468x60_as’:
$google_ad_width = 468; $google_ad_height = 60;
break;
case
‘234x60_as’:
$google_ad_width = 234; $google_ad_height = 60;
break;
case
‘120x600_as’:
$google_ad_width = 120; $google_ad_height = 600;
break;
case
‘160x600_as’:
$google_ad_width = 160; $google_ad_height = 600;
break;
case
‘120x240_as’:
$google_ad_width = 120; $google_ad_height = 240;
break;
case
‘300x250_as’:
$google_ad_width = 300; $google_ad_height = 250;
break;
case
‘250x250_as’:
$google_ad_width = 250; $google_ad_height = 250;
break;
case
‘336x280_as’:
$google_ad_width = 336; $google_ad_height = 280;
break;
case
‘180x150_as’:
$google_ad_width = 180; $google_ad_height = 150;
break;
case
‘728x15_0ads_al’:
$google_ad_width = 728; $google_ad_height = 15;
break;
case
‘468x15_0ads_al’:
$google_ad_width = 468; $google_ad_height = 15;
break;
case
‘120x90_0ads_al’:
$google_ad_width = 120; $google_ad_height = 90;
break;
case
‘160x90_0ads_al’:
$google_ad_width = 160; $google_ad_height = 90;
break;
case
‘180x90_0ads_al’:
$google_ad_width = 180; $google_ad_height = 90;
break;
case
‘200x90_0ads_al’:
$google_ad_width = 200; $google_ad_height = 90;
break;
case
‘728x15_0ads_al_s’:
$google_ad_width = 728; $google_ad_height = 15;
break;
case
‘468x15_0ads_al_s’:
$google_ad_width = 468; $google_ad_height = 15;
break;
case
‘120x90_0ads_al_s’:
$google_ad_width = 120; $google_ad_height = 90;
break;
case
‘160x90_0ads_al_s’:
$google_ad_width = 160; $google_ad_height = 90;
break;
case
‘180x90_0ads_al_s’:
$google_ad_width = 180; $google_ad_height = 90;
break;
case
‘200x90_0ads_al_s’:
$google_ad_width = 200; $google_ad_height = 90;
break;
}

?>
<script type=”text/javascript”><!–
google_ad_client = “<?php echo $google_ad_client; ?>“;
google_ad_width = <?php echo $google_ad_width; ?>;
google_ad_height = <?php echo $google_ad_height; ?>;
google_ad_format = “<?php echo $google_ad_format; ?>“;
google_ad_type = “<?php echo $google_ad_type; ?>“;
google_ad_channel = “<?php echo $google_ad_channel; ?>“;
google_color_border = “<?php echo $google_color_border; ?>“;
google_color_bg = “<?php echo $google_color_bg; ?>“;
google_color_link = “<?php echo $google_color_link; ?>“;
google_color_text = “<?php echo $google_color_text; ?>“;
google_color_url = “<?php echo $google_color_url; ?>“;
//–>
</script>
<script type=”text/javascript”
src=”http://pagead2.googlesyndication.com/pagead/show_ads.js”>
</script>

Source: http://www.mydigitallife.info/2009/01/17/google-adsense-legacy-old-generation-code-reference-generate-and-get/

Published by

Sandeep Verma

I’m an Entrepreneur. I’m proud to work as Blogger, LAMP Programmer, Linux Admin, Web Consultant, Cloud Manager, Apps Developer, Searcher. Concentrate > Observe > Imagine > Launch

Leave a Reply

Your email address will not be published.

*