07:27

How to create a Google Adsense banner

First, create a Google Adsense account for your website
Go to Google Adsense Homepage and register an account,
Once you validated your account, choose Configure Adsense => Adsense for content pages,
Choose the kind of banner you want from them (theme, vertical, horizontal, size, etc.) depending on the position of the banners in your theme, you'll get a unique Adsense code,
Copy your adsense code into an empty file, and save it as adsense.html.

Second, where do you want the Google Adsense banner to be seen?
In the {BANNER} zone of your theme?
In the {BANNER} zone of your theme AND in a menu?
In a menu dedicated to Google Adsense banner?
Using a {GOOGLEAD} shortcode within your theme.php file?

Create your website Google Adsense banner

Upload the file adsense.html to your e107_images/banners/ directory,

Go to Admin -> Content -> Banners and click on Create new banner on the right,

At campaign, enter "googleadsense",
To display the banner as a menu, refer to this explanation,
For client, enter "google",
Client login/password are not necessary,
Now click the Choose banner image button, and select the adsense.html file you uploaded earlier,
Don't fill the URL(Link) section
Leave the other fields blank until you get down to the Visibility section. Select who you want to see the banner,
Click Create new banner.
The space containing your banners in your theme should now show the Google Adsense (randomly with your other banners).
Display your Google Adsense banner as a Menu
Currently, you have 2 ways to show your Google Adsense as a Menu :

1. Use the Banner Menu
When creating your banner, make sure you give the banner a unique campaign name, like "adsense_menu" or something similar,
Now go to Admin -> Content -> Menus,
Activate the menu banner into the zone you want to show your banner,
Once it's activated, select configure from the drop-down box in the menu item,
Click on the campaign you created earlier that contains your menu banner, make sure it's shown in the Selected campaigns box,
Set your preferences for display, etc., then click update menu settings,
Your banner will now be displayed in the area you activated the banner menu in.
NOTE: You must go to Admin -> Content -> Banners and click on Banner menu on the right, to select the rendering of the campaign. (That is: in a menu table or plain).

2. Create a Custom Menus/Pages
Go to Admin -> Content -> Custom Menus/Pages and click on Create new menu on the right,
Name your menu (seen in Menus section),
Title of the menu (seen by users),
Copy your Adsense code into the text section,
Activate the menu in Admin -> Content -> Menus, you can configure the visibility of the menu there.
Display your Google Adsense banner using a shortcode
You can also display your Google Adsense by using a {GOOGLEAD} shortcode inserted into the $HEADER or $FOOTER templates in your theme.php file. This method is useful if you want the ad below your normal banner area, but before the rest of the page, or inserted within your footer area :

Using a text-editor, create a new file named googlead.sc and type in the following...

return ' ';

Paste your Adsense code in between the two single quotes that you typed in, above. Your file should now look something like this...

return '
http://pagead2.googlesyndication.com/pagead/show_ads.js">
';

You can edit the various google_xxx lines to change color values, for example, but do not change the line formatting, or google's script won't work (this is true for all the other methods above, as well).
Save the new googlead.sc file to your e107_files/shortcode/ directory.
You can now use the {GOOGLEAD} shortcode within your templates, as you would any other shortcode.

How to make your site XHTML compliant
Problems occur will using Google Adsense code as it is are with the javascript spelling.
A way to get around javascript warning is to put a var before every google_xxx of your Adsense code.

Something like this : var google_ad_client = "pub-xxxxxxxxxxxxxxx";
var google_ad_width = 728;
var google_ad_height = 90;
var google_ad_format = "728x90_as";
var google_ad_type = "text_image";
then this part of your page will be XHTML compliant ;)
Retrieved from "http://wiki.e107.org/?title=Using_e107:Content:Google_Adsense_Banner"

0 comments: