How to Monetize Your Blog Using Google Ads. Part 2


In yesterday’s post I showed you how to add Google Ads into WordPress widget areas. But WordPress offers a much wider array of possibilities than just widget areas. You can place your ads anywhere in WordPress.

However, to make use of the full potential of ad placement in WordPress, we need to go more in-depth. We need to make use of child themes and we need to play around with a little bit of PHP coding, too.

Relying on the instructions provided in the beginning of yesterday’s post, I will refer to the already created and saved Google ad code.

If you are using a theme that is updated from time to time, it is best to create a child theme. You can then make changes to the php files I mention in the sections below within the child theme instead of directly changing the php files of your active theme.

If you are not familiar with the topic, please, read my post about creating and using child themes.

Ads Above or Below the Header

Place the saved Google code immediately below the

line in your theme’s header.php file. This will place the ad on the very top of your blog, above the header image and navigation.

Or place the code right above the

line in your theme’s header.php file. You will find this or a similar line denoting the end of the header section towards the very end of the header.php file.

Ads Between Posts

This is a bit more complicated. Since most people display more than three posts per page, it is important to limit the number of ads served on one page.

Open your theme’s index.php file. Place the following line of PHP code right above the line that calls the loop:

The above code creates a counter, so that you can abide to Google’s limitation about the number of ads concurrently displayed on a page.

Place the counter and the saved Google code in your theme’s loop.php file. Wrap the ad code into a div
tag, like this:

You will have to check where exactly within the loop the above code belongs.

The easiest way to find out is to use Google Chrome (or Mozilla Firefox with the Firebug add-on installed). When you right-click on any item on a website in these browsers, you can select Inspect Element in the drop-down menu and find out where to place the above code.

Ads Within Posts

Placing ads within posts is a simpler variation of the previous solution.

You don’t need a counter, so you can simply add the saved Google code in your theme’s single.php file, towards its end:

Again, use the Inspect Element trick explained earlier to place the above code to the right position within the single.php file.

Ads Above or Below the Footer

Place the saved Google code above the

line in your theme’s footer.php file.

Or place the code below the

line but above the

line in your theme’s footer.php file.

Food for Thought

I urge you not to put too many ads on a post or a page. Google allows three ad units per post or page from its own network. If you violate the rules, you can get a penalty or a ban from the ad network altogether.

Some people combine multiple ad networks. They try to sidestep Google’s limitations and in the process bring in more ad revenue. But this approach might be counterproductive as many visitors shy away from websites overloaded with ads. Thus these sites might get less traffic by placing more ads.

Honestly, I don’t like websites with lots of ads. Especially not when the ads are merged into the flow of text within posts or between posts.

Too much advertisement leads many people to using browser add-ons that block advertisement altogether, such as AdBlock Plus.

And, from another point of view, let’s not forget that ads served by third parties pose a serious security risk to your visitors. There have been many cases of so-called malvertising, when malicious code was injected into the ad stream of an ad network infecting millions of computers.

Liked this post?

Subscribe to our newsletter to receive early notification of new posts and deals:
[mc4wp_form id=”45″]

Next Post »« Previous Post