Adding Adsense to Your Joomla! 2.5 Site

This tutorial shows you how to display Google Adsense ads on your Joomla! 2.5 website without installing an extension.

Requires you have a Google Adsense account. Should work for other ad providers that provide you with a code snippet for ads on your site.

It is less convoluted than it was for Joomla! 1.6 and Joomla! 1.7

Some images may be clicked for larger sizes.

It is very easy to place Google Adsense ads on your Joomla! site without installing an extension.

Yet, the last time I looked, there were at least 30 different Joomla! extensions to help you display Google Adsense ads on your site.

Embedding ads directly within your article requires a plug-in and is not covered by this tutorial.

Determine Ad Placement

You need to find a place for the ads on your site.

Ads are typically placed at the:

  • top of the page
  • bottom of the page
  • side of the page

See this article on how to enable Joomla 2.5 to display module positions.

To reveal the module positions available in your Joomla! template, append

?tp=1

to the end of your URL. As shown below, the various module positions available on this site are revealed:

You can choose to place ads in a currently empty module position, for example: position-6, position-8, position-3, position-0, position-12, position-2 , position-9, position-10, position-11 or position-14 in the case of this template. Or you can place them in already occupied module positions, for example, position-5.

Where you place the ad will determine the type of ad you place. For instance, if you choose to place an ad on the left position, then a narrow and tall ad makes more sense than a short, wide ad.

Remember the name of the module position where you want to place your ad.

Disabling the HTML Editor

Joomla! tries very hard to prevent users from entering malicious code. This also means it prevents adding legitimate code. To get around this we need to disable the HTML editor.

1) Select Global Configuration from the Site menu item:

2) Select Editor – None for the Default Editor:

3) Click on Save & Close to save the changes:

After you are done, you can restore the editor to the TinyMCE editor (or which ever editor you were using).

Adding Adsense

You require an Adsense account.

You also need the HTML code Google will provide you for your ad.

1) Select Module Manager from the Extensions menu item.

2) Click on New to create a new module.

3) Click on Custom HTML:

4) Fill in the module information.

Details

  • Title: enter a title for this module. If you want to display the title, something like Sponsored by is a good choice.
  • Show Title: select Yes to display the title, No to not display the title. NOTE: Adsense has strict rules about what you can and cannot display as a title. Usually, it is best to set it to No.
  • Position:·from the dropdown list, select the name of the module position you decided on earlier when determining your ad placement at the top of this article
  • Status: set to Published to show / display the module.
  • Access: ensure Public is selected.
  • Ordering: if there are other modules occupying your selected position, you can choose the ordering of the modules.
  • Start Publishing: leave empty.
  • Finish Publishing: leave blank
  • Language: leave as All.
  • Note: optional note to display in the module list.

Custom Output

This is where you paste the HTML code that Google Adsense gives you.

Advanced Formatting Trick

It is likely that the ads will be left justified in the module position.

You can horizontally center the ads by adding

<div align=”center”>

before the HTML code Google Adsense gave you and adding

</div>

at the end of the Adsense code.

Menu Assignment

Ensure On all pages is selected. This will place the ad module on all pages of your Joomla! site.

If you want some pages to be ad free, then select one of the other Module Assignment options (No pages, Only on the pages selected, or On all pages except those selected) and then select only those pages were you want the ads to appear or not appear.

5) Click on Save & Close

6) Observe that the module has been correctly installed. To locate the newly created module, I find it easiest to click on the ID column and sort the column in descending order (the newly created module will have the largest module number):

7) Check that the ads show up and are correctly positioned on your site (in this case, I created a single Adsense module in position-6 (the ad unit is wider than the position, so it is clipped):

NOTE: it can take 20 minutes or more after you create a new Adsense unit before it starts delivering ads. If you are getting a blank space instead of an ad, this is probably normal – check back in 20 to 30 minutes.