How to insert AdSense in Joomla

PDF Print E-mail
Share
Friday, 19 February 2010 20:12

Anyone trying to add AdSense into Joomla will discover pretty fast that Joomla is not an Adsense friendly environment. If you don't believe me go ahead and try it! The first thing i did was copy paste the AdSense activation script via JCE HTML editor - didn't worked. Next, i tried to insert it via the custom HTML module. Same result. And don't waste your time trying to figure out what is wrong with your Joomla installation.

The thing is that Joomla can't handle this. And the reason for this is that Joomla is a good CMS which takes security seriously - and as part of the security effort it won't allow you inserting any script (and AdSense is javascript in case you didn't know). So how we're getting it done nevertheless ? This is what this tutorial about.

Obviously there are 3 ways of doing it :)

  1. Using an AdSense dedicated component- there are plenty of plugin in Joomla Extensions Directory that all their purpose is to handle AdSense. Each one of them has it's pros and cons - i'm not going to get much into this option, since i'm looking for a more generic solution. If you feel like you have the time to try and test such components go a head and please share your findings in the comments below.
  2. MOD HTML - this simple module does the job. It does pretty much the same as the Custom HTML module which came with Joomla - allow you to put any custom HTML inside it. The only difference that MOD  HTML will not strip the "script" tags out of it. You can use this module for any script and not just AdSense. Download it from here: http://extensions.joomla.org/extensions/edition/custom-code-in-modules/5435.
  3. googleAds plugin - in case you want your ads inside a content item, module is not the best solution (although you can put module inside the content). This plugin will give you what you need - just surround the AdSense script with {googleAds} tags. Get this one from here: http://extensions.joomla.org/extensions/ads-a-affiliates/google-ads/5022.

The last two options should provide you solution for any combination you need with AdSense and any other script in general.

Good luck with AdSence!



 

Add comment


Security code
Refresh