Blog > Monetization > How to Automatically Inject Ads into Your WordPress P...

How to Automatically Inject Ads into Your WordPress Posts

Published by Kenny NovakMonetization • Posted October 23, 2015
Written by

Bloggers want to make money. When you’re a newbie blogger, or you’re still working more on growing than on developing products on the side, the easiest way to make money is to run ads on your site. The problem with that is, well, we’ll get to that.

I’m targeting this post at users for a few reasons. First, it’s an incredibly popular blogging platform. Most of you reading this, if you own a blog, probably run WordPress. The rest of you might do well to consider it.

Second, is very highly customizable. The process I’m discussing – ad injection – requires that customization ability. It won’t work with, no matter how much you pay, because they require that you use only a limited selection of pre-chosen plugins. This one is not one of them, but don’t worry; neither are literally hundreds of thousands of others, many of them good and valuable.

Third, it’s easy to do what I’m talking about. You don’t need to monitor complicated systems, you only need to configure a plugin and hook it into an ad account or two. Everything else is more or less done for you. Of course, you have a broad range of configuration options if you want to use them, but many of them aren’t strictly necessary.

All that said, let’s start from the beginning, where most bloggers begin with monetization; AdSense.

The Benefits of AdSense

There are some benefits and some drawbacks to using AdSense on a WordPress blog. Let’s start with the benefits before I touch on the drawbacks and move on.

First, AdSense is a Google product, which means it’s reliable, it’s not a scam, and it’s going to pay you as long as you follow the rules. However, being a Google product, that means they have a lot of resources to throw at problems like fake traffic and abuse. If you’re trying to do something black hat or against the rules, you can and will be banned.

Second, it’s trivially easy to register for and set up. Using the official Google AdSense plugin, you can have AdSense monetizing your WordPress blog in minutes. If you like, you can do that and stop here. I’m going to be talking about some more advanced techniques, though.

Official Adsense Plugin

Third, AdSense is essentially on autopilot. You can configure a lot about it, but you don’t have to, and even if you don’t, it will do a decent job of conforming to your blog. Google uses context analysis to determine the topic of your blog and will attempt to display only ads that are relevant and likely to earn a click, which leads to high click rates and a good chance of making money.

AdSense is also great for running on multiple sites. You don’t need multiple accounts for multiple sites, though you can if you want. Google isn’t a fan, but it alone isn’t necessarily grounds for cancelling an account. As long as you’re not using an alternate account for fraudulent purposes, you should be fine.

On the flip side, AdSense ads don’t tend to pay a whole lot. They’re very common and used throughout the web, so they are often victim to ad blindness. More on that in a moment. Pay rates tend to be rather low for most niches.

That said, AdSense scales very well. It benefits greatly from having a high level of traffic, so as you grow, so too will your earnings. Advertisers will pay a premium for space on a high profile site, so as you get bigger and better, so too will your paychecks.

I mentioned that Google can cancel your account for fraud, and they are not hesitant to do so. Unfortunately, sometimes they jump the gun and will cancel accounts for fraud that the account holder is not perpetrating. In a sense, there’s almost a Negative-SEO-like practice of nuking AdSense accounts, though it’s not a huge threat.

Finally, AdSense doesn’t exclude you from using other advertising methods as well. They caution you against using too many ad units on one page, and with good reason; overuse of ads is both a detrimental SEO factor and a sign of a low quality site. However, nothing stops you from using both AdSense and an affiliate program.

Using Alternative Ad Systems

Adsense Alternatives 5

Sometimes, AdSense just doesn’t do it for you. That’s okay! There are many reasons. Maybe you don’t like the low pay rates, and you found a PPC network that has both good stat tracking and higher pay rates. Maybe you’re not fond of Google’s domination over all things Internet and would prefer to see them cut down a peg. Maybe Google blocked you from the program and won’t allow you to operate an AdSense account.

No matter the reason, there are always alternatives available. AdSense is a specific type of text and display ad program, using PPC as a marketing method. You can choose to go with the volume-required PPM method, you can stick with PPC, or you can shoot for something more lucrative with pay per lead and affiliate marketing. You can even use a combination of the above. It’s entirely up to you.

Thankfully, Google is not so dominant in the blog marketing and advertising niche that you’re handicapped not using them. You have a lot of different options, and they tend to change from time to time. Formerly good ad networks can see a change of leadership and lose trust, while formerly low-tier ad networks can improve their game and work to gain more customers. It’s all a very tumultuous industry.

I like to recommend various lists of ad networks, such as this one on Road To Blogging. However, be cautious using these lists. Some ad networks will pay for priority placement in some lists, and some lists are biased for one reason or another. At the same time, you want to make sure you’re using an up to date list, otherwise you risk operating on outdated information, which can hurt you.

Adsense Alternatives 5

Adsense Alternatives

One of the benefits of the method I’m going to show you is that it works with a wide range of ad networks, not just AdSense. Normally, if you want to use any network other than AdSense, you have to hope that you can find a plugin that supports it, and you have to hope that the AdSense plugin doesn’t conflict. With my method, it’s all supported in one plugin.

The Problem of Ad Blindness

Ad blindness

I’ve alluded to this twice in the post so far, so now it’s time to actually address it. Ad blindness is the concept of ignoring ads, even though they’re right there. How many websites that you visit each day have banner ads across the top or down the sidebar? I challenge you to make a guess, and then spend a day and count. I can almost guarantee that your guess will be low, simply because you’ve been ignoring the ads on those other sites for so long.

There are some different ways of beating ad blindness. One is quite simple; put the ads somewhere they can’t be ignored. The problem with this is that people are very good at ignoring things based on patterns. That’s why it’s detrimental to replace a banner ad with something you really want seen; people are not ignoring the ad itself, they are ignoring that slot on your website. Even adding ads in between paragraphs of text can be skipped over easily enough.

The real solution is to use a type of ad that doesn’t look like an ad. That’s why AdSense textual ads are great, and why native advertising is such a good prospect. Native ads are ads like Outbrain’s work, that are designed to look as much like site elements as possible. If you click what you think is a link to a legitimate source and it turns out to be an ad, well, that’s not necessarily a bad thing. As long as the destination of the ad is relevant and can work as a source, you’re fine.

Some people tend to shy away from this concept out of fear of disclosure laws. This generally isn’t a concern, though. You might notice that Outbrain ad boxes, despite looking native, tend to have an Outbrain logo on them. That counts as disclosure, and it’s all they need.

The ad injection I’m going to show you is a sort of combination between textual ads and native ads. They look and act like regular links, but they have the disclosure and payment prospects of PPC links.

Ad Injection: The Solution

Ad injection is an interesting concept. Before we continue, though, I want to make a note that if you run a search for “ad injection,” you’re going to find a lot of negatively skewed posts. That’s because the type of ad injection I’m talking about is different from what they’re talking about.

What these other posts are talking about is the concept of maliciously injecting ads into the content of sites you don’t control. Essentially, hack to gain access to a site, add code, save the changes, and leave. You’re not damaging the site directly, you’re not trying to steal information in a private database, you’re not there to destroy the site. All you’re doing is putting ads in place that make you money based on work and a foundation you did not build.

I don’t support this type of ad injection, of course. Any form of malicious compromise of a site is bad for everyone involved, from the hacker to the clueless user.

Here’s the thing; ad injection in the sense I’m using works the same way. You’re injecting ads into content. The difference is, this content is content you control. You’re using a WordPress plugin to manage ads on your site, injecting them into your content so you don’t have to worry about manually managing it.

The primary benefit of the ad injector is that it varies the position, length and content of the ads depending on the post context and content. That means you don’t have to worry about users ignoring areas of your site; they would have to ignore your blog posts entirely, which they aren’t likely to do as long as the content is high quality. You are writing high quality blog posts, right?

Features of the Ads Injector

Ad Injection Plugin

This particular ad injector is the plugin I like to recommend. It has been regularly updated to keep up with WordPress updates and to keep itself full of features. It has a generally high star rating, though with a low number of reviews those aren’t necessarily the most accurate representation of the quality of a plugin. I honestly recommend just giving it a try. You can hardly go wrong with it, given that it’s not going to steal your information or anything of the sort.

With this plugin, you can use a wide range of ad networks. AdSense is included, as is Amazon’s associates program, Clickbank, Trade Doubler and a lot more. It’s actually difficult to find a network that isn’t covered, and if you do, you can message the plugin creator and get them to add the function to the next update.

You are given detailed control over the number of ads that show up in a piece of content, based on the length of that content. Essentially, you set word count thresholds and when content surpasses them, an additional ad is shown. This guarantees that you won’t have cases where the chosen ad density is overwhelming for a smaller post.

You are also able to restrict the ad visibility based on a number of factors. You can exclude age ranges, visitor referrer, or even IP address. If you know that users from a particular domain – say, Reddit – tend to dislike ads more than other users, you can disable or downplay the number of ads for viewers coming from Reddit. You can also specify a certain point or a certain character in your content to designate a stopping point, below which no more ads will display. This helps you avoid cases where an ad separates out the last two sentences of an article and makes it seem as though you have no conclusion.

If you want a more reliable setup, you can use ad templates with the plugin as well. These will guarantee a certain layout for ads within your content, though it’s not always going to mesh perfectly or work properly. It will require a good deal of testing.

Of course, there are always the base features. You can restrict ads from showing up on specific pages or posts. You can include them in the top and bottom header and footer. You can put them on archive pages and home pages instead of just blog posts. You can even cache them – the plugin works with high profile caching plugins like W3 Total Cache and WP Super Cache.

Possibly the best part of using an ad injector like this one is that it’s a site-wide script, but it applies on the page level. Once you add the plugin to your site, ads will appear on every blog post you’ve made, except the ones you’ve excluded. They will follow the general or specific rules you set, and they will immediately start making you money.

If you’re a data fiend, you can also get some ads analytics and split testing with this plugin. The link, again, is here. It’s well worth checking out, if you’re interested in monetizing your blog but aren’t sure how to do it.

One great feature is the ability to inject something other than an ad. You can inject social media butrons, random images, and even opt-in forms. The sky is the limit here.

I will warn you; this plugin can be simple to set up at a basic level, but if you want all of the advanced functionality, including the testing, alternate content for blocked ads, and advanced injections, you will need to do more manual configuration. This isn’t easy. Still, it’s worth the time to learn.


  1. Joachim


    Hi Kenny,

    Thanks for the insights.

    Unfortunately, the Google Publisher plugin has been closed and removed in 2017. The ad injection plugin is still available, but it has not been updated for more than 3 years. I would not recommend using this plugin anymore.
    If you are looking for a free alternative, check Advanced Ads. I think this one provides currently the most comfortable AdSense integration:

Leave a reply