Skip to content


Adsense In Joomla

On the one hand, Joomla is a fantastic content management system. On the other, getting extensions to work is a nightmare.  Anyone who's had to do anything over and above the default activity of publishing new articles with images in them will know how difficult it is to find an extension that does what they need it to do. Sometims there is an extension you can use, but the creators use other words to describe their product than the ones you use to search so you can't find it. Other times you find an extension that appears to fit the bill, but for whatever reason it just doesn't work, despite you following the installation/implementation instructions to the 'T'. Still other extensions require you to do scary levels of messing with code.

Of course, once you find your dream extension and learn how it works you can use it again and again on all the future Joomla sites you create so don't think of it as a fruitless exercise. Infuriating yes, fruitless no.

My journey to find a way to insert Adsense into Joomla articles was particularly painful. Most of the extensions I found enabled me to insert Adsense in sitewide fashion. That is, you specify what Adsense and where and these settings get applied to each and every article on your site.

What I needed (and what you should want) was the ability to vary the location and Adsense settings at article level. Some articles you write may be very short so you might want just one image based Adsense block right at the start of the content. Other articles might be huge, affording you the luxury of peppering the content with a variety of different Adsense blocks of different formats. You don't want to use a one size fits all articles approach.

Enough whingeing. Here is the Joomla Adsense extension I found that allows you to specify what Adsense and where, at article level. There's also some basic instructions telling you how to use it too, in case you're a halfwit like me.

Behold. The googleAds Plugin

insert-adsense-into-joomla

Up to this point I've been meticulously referring to this 'tool' as an extension because it's for Joomla. Now it turns out that the publishers are calling it a plugin! I thought plugins were for WordPress...</sulk>

Here is what you need to do.

  • Download the googleAds plugin somewhere on your hard drive. Leave it zipped.
  • Install the 'plugin' by clicking Extensions > Install/Uninstall, and then click the browse button against the Upload Package File input box. Find the zipped package (ooh er matron...) and upload it.
  • Enable the plugin by clicking Extensions > Plugin Manager, and click in the Enabled column against the googleAds plugin. The plugin is now active and you can start adding Adsense to your articles. Have a cigar.
  • At this point the instructions are confusing, so stick with me. You can use the WYSIWG editor to insert your Adsense code. In fact, I'd be wary of using anything else, as sometimes important bits of code get stripped out if you do. So use the WYSIWG editor and wrap these special tags around the code - {googleAds} and {/googleAds}. In other words, enter {googleAds} your Adsense code {/googleAds} in the WTF editor - anywhere in the joomla article.

One thing to be aware of is the WYSIWG editor's quirk of keeping the original formatting of text you copy when you paste it in. This formatting may interfere with the Adsense code you're trying to insert. For example, I though a quick way to get my Adsense code would be to copy it from a web page on which it was already present. So I pressed ctrl-U (Firefox) to view the page source and copied the Adsense code. When I pasted it into the WYSIWG editor, however, it had strange formatting (it was way too small) and the Adsense didn't display in my Joomla article.

I've found that a quick way to strip out any pesky formatting is to paste the copied text into notepad, select it all again and then paste it into its final destination.

If you enjoyed this post, make sure you subscribe to my RSS feed!

Posted in articles.


2 Responses

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.

Continuing the Discussion

  1. Exploring Your New Website Thoroughly linked to this post on October 14, 2009

    [...] Adsense In Joomla [...]

  2. Adsense Tutorial - Positioning linked to this post on November 2, 2010

    [...] in sharp contrast, have a hell of a time inserting Adsense code into their articles (read how to insert Adsense into Joomla!). To add Adsense to a WordPress post or page, do the [...]



Some HTML is OK

or, reply to this post via trackback.