In this tutorial I am going to show you how you can automatically inject ads into post and page content in your WordPress site using the free ad plugin Advanced Ads.

Update: there is an updated manual for the Post Content Injection.

Backstory

There is a ghost going around – the ghost of ad blindness. It spooks publishers that carefully put there ads into header and sidebars and now steadily see the ad performance decrease.

Maybe less mystical, but not less scary is the real story of ad optimization in the last years. For content pages, the only constantly well performing ad placement is very close or even within the content.

For many publishers however, this is hard to set up. A lot of simple ad plugins don’t support ad injection, others are too complicated due to a lot of unnecessary or poorly explained features. With the ad injection in Advanced Ads I hope to have found a balance.

Setup

This tutorial was written using

This tutorial makes use of the content injection type of placements, a feature also explained in the manual.

Ad Settings

First of all you need an ad to inject into the content. If you don’t have one already, just create it in your WordPress dashboard under Ads > Add New. Choose a custom title and the plain text ad type.

For test purposes you can use the following ad content.

<div style="display: inline-block; background: #ddd; width: 468px; height: 60px; line-height: 60px; text-align: center;">DEMO FULL BANNER</div>

Layout / Output

Visit the Layout / Output meta box to define some additional settings regarding the position of your ad within the content.

For the demo ad on this page I made the following settings:

ad injection layout settings

Display Conditions

If you want to limit the content injection to only posts, by category or any other option, simply visit the Display Conditions meta box on the ad edit screen.

For the sake of this tutorial, I set the ad to be displayed only within this post:

ad injection display conditions settings

Placements

Create a new placement

The next step is to visit the Placements page of the Advanced Ads options and to create a new placement. Choose the post content type first, some name and unique id, like I did on the screenshot.

ad injection new placement setting

You can also choose the before post or after post placement in case you want to inject the ad directly before or after the post content, but in this tutorial we want to inject it between some paragraphs, right?

Now, save your placement.

Setting up the ad injection placement

Once you see your new placement in the placement list, you can choose some options there.

ad injection options

Item

The Item is the ad or ad group you want to display on this placement.

Before/After

Select whether the ad should appear before or after the reference element you are going to select below.

Element index

Select the index of the reference element. e.g. Select 3 to inject an ad before/after the third paragraph.

Reference Element

Select the kind of element before or after which the ad should be placed. You can choose between paragraphs and three different levels of headlines.

Tip: if you didn’t notice yet, the second row of options can be read like a sentence 🙂

For the demo ad on this page I used the following settings:

ad injection demo options

Don’t forget to save the placements now.

You are DONE

What else you might want to know

Content created by shortcodes might not be considered when searching for the reference element, yet. Also other automatically created content might collide with the ad injection.

In case the reference element is within another element like a box, the injected ad will be too.

When there is no reference element with the given index found, the ad is not injected at all.

Tagged: