Adding advertisements to Mambo using Google AdSense requires two things - a Google AdSense account and a custom module. There are many 3rd party extensions available for adding AdSense code however the recommended way to do this is to create your own custom module to hold the AdSense script.
Getting Started with AdSense
Before you get started you will need to create an account with Google AdSense. Login and go to the AdSense Setup tab then choose your product - AdSense for content to place advertisements on your site or AdSense for search to add a search box to your site. Follow the steps until the Ad Code window displays, showing the source code to add to your web site. This is the code you will use later with Mambo.
Adding the AdSense Code to Your Site
Once you have been through the steps on your Google AdSense account and generated the code you need to add this to your Mambo web site. There are three ways in which this can be done.
Adding the AdSense Code to Your Template
If you are comfortable with editing your template and know your way around HTML and CSS, you may choose to edit your template's index.php and hardcode the AdSense code directly into the template. This is ideal if you wish to display the advertisements on every page of your site or if you are experienced with using the PHP conditional display, for example, to only display the advertisements on your frontpage.
Third Party AdSense Extensions and Why You Should Not Use Them
Most 3PD extensions for Google AdSense install easily and are quick to set up, so why should you avoid them? Well, most add PHP code and parameters to achieve the same thing Google's code does. This results in additional queries on your site (which can affect performance), can potentially introduce security risks if the extension is not properly secured, and in a number of reported cases the extensions look good and appear to work, but clicks are not being reported to Google. Sites that pull in the advertisements and appear to work but which do not register the click-throughs just don't earn a site any money, which defeats the whole purpose of displaying the advertisements.
While adding a custom module will not give you the extra bells and whistles some of the 3PD extensions give the method I will describe below is reliable and will not cause you to lose any income.
Creating a Custom Module for AdSense
For most Mambo users, this is the preferred way to add AdSense to a site:
Login to your administrator backend and go to Modules then select Site Modules. NOTE: If you are using a WYSIWYG editor, go to Configuration first and turn the editor off. (Some editors filter the content you add to modules and will strip out code such as JavaScript).
On the toolbar, select New to create a new, custom module.
Give your module a name so that you can easily identify it when you look at the list of your site modules. Set it to published and select which usergroups will be able to see it.
You will probably not want the module name to be displayed on your site so set this to "hide".
Your AdSense module will need to be allocated to a module position, just like any other module. In this example, the module has been set to publish to the left module position. You can choose any available position you like.
If you wish to style the module then give it a module class suffix for easy styling through CSS (otherwise, ignore this).
Taking the code that was generated for you within your AdSense account, simply copy it and paste it into the Custom Output box.
From here on, you simply treat this new module like any other module. Select which content you will display the module on. Then save.
If you enjoyed this post, make sure you subscribe to my RSS feed!














{ 1 comment… read it below or jump to the comment form to share your opinion }
great info, nice reading. thanks
Leave a Comment