Adding Google Adsense to your WordPress website

You have a WordPress website and you want to  monetize it. Your first monetization strategy might very well be Google AdSense. It is the most popular ad network. It offers one of the highest CTR (Click Through Rate) for every page. You can decide the types of ads and you have control over the ad placement.

But to get Adsense approval is not very easy. Adsense has some  rules and requirements. If you have made it through and your site is approved, now is the time to add the ads to your site.

You can also place ads in the sidebars, in the header and in the footer. They can even be placed within the content of your your posts or pages.

Getting your Adsense code

Login to your Google Adsense dashboard. Click on My ads from the top menu. Click on New ad unit to create a new ad unit.

You will see a screen as below. Here give a name to your ad. This is only for your reference.

Now choose the Ad size. There is a wide-variety to choose from. Choose from one of the recommended sizes, because this gives a better payout.

Next, choose the Ad type. Choosing Text & display ads is recommended.

The other settings are optional.

Ad style helps you to control the colour of your text ads. Use your site's color scheme.

Click on Save and get code. Copy this code.

Method 1: Placing ads through widgets

This is probably the easiest way to add Google Adsense to your site.

The following examples assume that your WordPress theme has several widget zones available, in the footer, or in the sidebars, like in the  Customizr theme or in the Hueman theme.

From the customizer, click on Widgets. Here you will find a list of Widget areas.

Placing ads in the footer

For instance, if you want to add ads to the footer, choose Footer Widget Area One (or Two or Three). Add a text widget to this Widget Area.

Place the already copied ad code into this text widget.

Save and Close.

Visit your site to take a look at the ads. It might look like the screen below, where there are ads in all three footer widget areas.

Placing ads in the sidebar

If you want to add an ad block to the sidebar, from the customizer, go to Widgets->Left Sidebar (or Widgets->Right Sidebar as the case maybe). Add a text widget to this Widget Area.

Place the already copied ad code into this text widget.

Save and Close.

Visit your site to take a look at the ad.

Method 2 for developers: Placing ads through hooks

This example illustrates a way to insert your ads with the hooks of the Customizr theme.

If you want your ads to appear in other areas, which are not normal widget placement areas, say after the featured pages on the front page, or before the header, or after the title in single posts, you will need to use the hooks of the Customizr theme.

For instance, if you want to add an ad block - a leaderboard (728 x 90) - after the featured pages in the front page, hook into __after_fp.

Add this code to your child theme's functions.php. Ensure that you place your ad code in the function. (example of code below)

add_action('__after_fp' , 'display_leaderboard');function display_leaderboard() { ?>
<center> <script async src="//"></script> <!-- leader --> <ins class="adsbygoogle" style="display:inline-block;width:728px;height:90px" data-ad-client="ca-pub-1122334455667788" data-ad-slot="8029757792"></ins> <script> (adsbygoogle = window.adsbygoogle || []).push({}); </script> </center> <?php }

Visit your site and take a look at the leaderboard ad spanning across the width of your frontpage, just after the featured pages and before the grid list similar to the screen below.

There are numerous hooks in the Customizr theme which will facilitate you to place ads wherever you want.

Method 3: Managing ads through plugins

One very easy way to manage your ads is to use Google Adsense plugins like Advanced Ads Inserter.

With such varied options, you can craft an exquisite site that monetizes using Google Adsense. Go ahead and do it!

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.