Adsense Employer

Added: 04 January, 2007
Downloads: 259
Required: php
Ratting: 5

This is small php script which will allow you add adsense codes easily on multiple pages, you can remove adsense codes for all of your pages with one click! This script uses function to write adsense codes, each time you have to declare the ads height and width and it will create the code just as the code supplied from adsense. If the height or width is invalid format it also detects it and shows waning! It can also show referal ads randomly on your webpage.



To use this script you should have basic knowledge of php. If you don't know php or don't understand any point below. Then I'll highly recommend you to not to use this script.

STEP 1: TWEAKING PHP FILE

Tweaking this file carefully is very important so first we should tweak this php file carefully.


First form this part of code change the values of  $show[ad_unit], $show[link_unit]  and $show[referal] to enable or disable ads in your site. Set them to 1 to show ads, set 0 to hide

This part controls showing of ad unit in webpage. From the part where AdSense codes starts, carefully change value of  google_ad_client and  google_ad_channel to your one. By default they are set to ##### you should change this to your one that can be found from your codes provided from adsense website



This part controls showing of link unit in webpage. From the part where AdSense codes starts, carefully change value of  google_ad_client and  google_ad_channel to your one. By default they are set to ##### you should change this to your one that can be found from your codes provided from AdSense website

This part controls showing of referal ads in webpage. This selects a random value from1 to 4 to show any of four referal formats.

To edit first log in to your account in adsense and generate four codes for four referal ads of your choice.
Remember you should generate referral ad codes of same width and height

From the part where AdSense codes starts, carefully change value of  google_ad_client and  google_ad_channel to your one. By default they are set to ##### you should change this to your one that can be found from your codes provided from AdSense website

Now mark out the four different values google_cpa_choice found from four different ad codes generated from AdSense website for four referral ads.
Put their values in $choices array. (Default values are marked with $$$$)
Set the width and height from google_ad_width and google_ad_height.
By default their values are @@@ and &&&
 

Customizing color format
Just change the hex values respectively found from your original ad codes

STEP 2: Implementing
Include this file at the top of your php pages with this code. Don't forget to correct the url

 

Showing Ad Units

To show ad unit add this script where you need.

Change width and height with your choice. But that should be a AdSense valid ad unit width and height. If it is invalid, this script will show error.

Such as, to show 120x600 Ad Unit add this script

Showing Link Units

To show link unit add this script where you need.

Change width and height with your choice. But that should be a AdSense valid link unit width and height. If it is invalid, this script will show error.

Such as, to show 468x15 link Unit add this script

Showing Random referral ads

To show referal 1 ads
To show random referral ads add this script

Similarly 2 for showing 2, 3 for 3 and 4 for showing no 4 referal ad.

To show randomly use this code. Just use 0 instead of 1,2,3 or 4

 

Checking Correctness:
To check if your ad codes output from the php file completely matches your original code or not, upload checker.php into server and open that file through browser. Save the page in your computer and open it with notepad. Now match all the codes generated by the script with your original one. If it don't match, then you should have make mistake in editing the adsense_employer.php file. Edit the file again to solve problem. If still it don't match you code. Then don't use this script.