Google AdSense Integration

In order to start using Google AdSense you need to create an account first. This can be done at:

https://www.google.com/adsense/

Click on the Sign Up button to proceed. Fill in all required details and be sure to read the Google AdSense policy before completing the sign-up procedure.

Once the sign-up procedure is completed, you will get a welcome e-mail with instructions on how to use the Google AdSense tool.

Log in the Google AdSense panel and using the included wizard generate the Google AdSense code according to your preferences.

It will be similar to the following one:

<script type="text/javascript">
<!-- google_ad_client = "pub-UNIQUE_NUMBER";
/* 300x250, created 29/03/10 */
google_ad_slot = "11111111";
google_ad_width = 300;
google_ad_height = 250;
//-->
</script>
<script type="text/javascript" src="http://pagead2.googlesyndication.
com/pagead/show_ads.js">
</script>

Instead of the "UNIQUE_NUMBER" string you will see a number which is generated by Google and is unique for your account.

In the Google AdSense panel you can check the reports regarding the Google AdSense activity on your web sites. Also, from there you can generate code for advertisement blocks with different shapes and formatting and tune your AdSense setup.

Once you have the Google AdSense unit code you should include it in your web site.

If you have an HTML web site, you can include it directly in the source code.

If you wonder which is the best position for your Google Adsense advertisements, you can check this article:

https://www.google.com/adsense/support/bin/answer.py?hl=en&answer=17954

Basically, the way to include the code depends on your web site technology and personal preferences.

Most of the popular php scripts come with additional extensions which allow you to insert the Google AdSense code without editing your files.

Here we will show different ways to include the code in open-source PHP projects.

We will start with Joomla 1.5, which is probably the most popular open source CMS.

You can find comprehensive instructions on how to install and use the software in our tutorial:

http://www.siteground.com/tutorials/joomla15

There are many different approaches for integrating the Google AdSense code. We recommend that you use a Joomla extension for this purpose.

Using such an extension allows even people who know nothing about programming to enable Google AdSense for their accounts.

You can choose the preferred extension from the following resource:

http://extensions.joomla.org/extensions/ads-a-affiliates/google-ads

Then you must follow our Joomla 1.5 tutorial in order to complete the extension installation:

http://www.siteground.com/tutorials/joomla15/joomla_extensions.htm

Some extensions allow IP blocking. This way you can block yours and prevent a violation of the Google AdSense Terms of Use while performing tests.

Another widespread open-source script is WordPress. This application is one of the most popular free blogging solutions.

You can find detailed information on how to install and use it at:

http://www.siteground.com/tutorials/wordpress/

Since inserting the Google AdSense code directly in the WordPress theme's source code requires some programming knowledge, we will use a Google AdSense plugin.

You can choose the one which best covers your needs at:

http://wordpress.org/extend/plugins/search.php?q=adsense

Detailed instructions on how to install plugins can be found in our WordPress tutorial:

http://www.siteground.com/tutorials/wordpress/wordpress_plugins.htm

Also, every plugin has an Installation tab and the specific installation instructions are published there.

Once you install and activate the plugin, you should enter the specific code generated through the Google AdSense wizard.

Most of the other scripts have similar solutions for adding the Google AdSense code. You can either use an external extension or you can insert it directly in the source code of your web site.