How to create an AdSense alternative with affiliate links

In this tutorial, you’ll learn how to create and optimize your custom AdSense alternative for WordPress.

This AdSense alternative is relevant for users who have been rejected by Google AdSense or who, due to the GDPR, do not wish to display ads without visitor consent. Naturally, testing this setup is also worth for newbies as well as for experts in affiliate marketing who look for different ways to monetize their websites. It could also be an unusual solution if you have many users with ad blockers that you want to monetize.

How does this alternative to AdSense work?

The classic text display ads of AdSense consist of title, subtitle, and description text presented in a fixed layout. They are based on the content and, where applicable, the user interests. You get revenues for every click. 

The AdSense alternative that we share in this tutorial is very different from the concept behind Google AdSense. This setup presupposes that you already have affiliate partners that you can link in your texts.

You can place affiliate text links directly into the content using this configuration. They will fit perfectly into the overall aesthetics of your website and might encourage more visitors to click on them. Using conditions, you can target the text links according to your website’s content or visitors. Displaying more relevant ads to your users can increase clicks and improve your click-through rates (CTR).

Travel website with the AdSense alternative based on affiliate links
Example of the AdSense alternative on Travelguide Marrakech

Affiliate Marketing

Affiliate marketing means recommendation marketing. There are various affiliate networks and brands that offer an affiliate partnership. In contrast to AdSense, nearly all affiliate programs pay a commission for sales and leads generated by the affiliate traffic. Depending on your content, this performance-based commission can result in higher revenue than the click-based revenue of Google AdSense.

Most affiliate networks offer a selection of banners and other advertising media. Text links are still standard. You can use them to link directly to sub-pages for a particular product or service of a partner. For example, this can be a Booking.com link to a hotel in a specific city or a deep link to a certain product on Amazon.

  • Find a curated collection of different affiliate networks sorted by industry on authorityhacker.com.

The look of AdSense text ads is simple and old-school: the hyperlinks are blue, followed by the link URL in green color and closed with a descriptive text in black. Since many websites use a similar style, this standard configuration of AdSense text ads does its job in many cases.

“A text ad typically includes a title that’s also a clickable link to a web page, one or two lines of text and a website address shown in green. Text ads are sometimes known as “sponsored links” because the title links to the advertised website. These ads can appear on Google search results pages and across the Google Display Network. Text ads might look slightly different on the Display Network.”

Google’s description of its text ads

Below you can find an example of how the setup described above should look in the frontend.

Example of our AdSense alternative with a group containing several text link ad units

Our text-based ads consist of some basic HTML in the content of the ads and CSS to make it look like AdSense ads. You can just copy the code from the tutorial below to your site.

At first, we need to create ad units. Similar to the AdSense version, each of these ad units consists of three parts:

  1. the title (including a link to the website)
  2. the address of the website
  3. and one or two lines of text

We will create individual ad units for each text ad to make it possible to target and track each one individually. We will put the ads in an ad group to show multiple ads at the same time – like AdSense did this earlier with its Text ads only ad units.

Repeat the following steps for each single text ad:

  • create an ad of the type “Plain Text and Code”
  • insert the code below in the text box in the ad parameters section
  • adjust the header line, the link text and the URL according to your affiliate partner
<div class="textadblock">
<a href="https://www.youraffiliatepartnerlink.com" class="textadlink1" target="_blank" rel="noopener noreferrer">The heading line linking to your affiliate partner</a>
<a href="http://www.youraffiliatepartnerlink.com" class="textadlink2" target="_blank" rel="noopener noreferrer">www.youraffiliatepartnerlink.com</a>
<span class="textstyle">A descriptive text about your partnerlink usually filling one or two lines</span>
</div>

Based on this ad unit, you can create as many ads as you need. Just add your affiliate links and change the text to your requirements.

Defining the CSS classes

As you can see, we have four CSS classes here.

textadblock defines the overall typography like the font family and the line-height for the whole ad content. It also adds a little margin below each text ad.

The CSS classes textadlink1 and textadlink2 style the links in the text ad and make them blue and green.

Finally, we use the class textstyle for the description.

Insert the following CSS code directly at the end of the style.css of your theme or the “additional CSS” text box in the customizing options. These CSS classes make sure that the text ads have a consistent look. We work with pixel values for the typography to give it a fixed size that looks the same on every device.

.textadblock {
font-family: Arial,sans-serif;
line-height: 18px;
margin-bottom: 10px;
}

.textadlink1 {
font-weight: bold;
font-size: 14px;
text-decoration:underline;
color: #000fff;
display: block;
}

.textstyle {
font-size: 12px;
color: #000000;
display: block;
}

.textadlink2 {
font-size: 12px;
color: #008000;
display: block;
}

.textadgroupframe {
border-top: 1px solid #bbb;
border-bottom: 1px solid #bbb;
padding: 20px 0px 20px 0px;
}

.textadgrouphead {
font-size: 8px;
}

As you can see, this CSS code also contains the classes textadgroupframe and textadgrouphead. They wrap some thin borderlines around our grouped ad units and style the small header with the label “Advertising” above the block with the ad units. You will see these CSS classes in use below.

Group your ad units and create a controlling ad unit

We will now collect three ads in one group and embed this group with a shortcode in a controlling ad unit.

  • put the ads in a group
  • set the group type to “Random ads”
  • set the number of “Visible Ads” to “3”
  • note the ID of the group (you will need it in the next step)
Group of targeted affiliate links as an alternative to AdSense
Ad group with three text ads that will display in random order

To put all ads in one consistent layout block and deliver all ads through one group, we create a new control ad unit for our AdSense alternative. This ad unit contains the ad group shortcode, which is embedded in a div container that adds a headline and horizontal bars to make the displayed text ads stand out of the other content.

  • create a new ad unit of the type “Plain Text & Code”
  • put the code below into the ad parameters text box
  • adjust the ID of the ad group
<div class="textadgroupframe">
<span class="textadgrouphead">Advertisement</span>
	[[the_ad_group id="123"]]
</div>Code language: JavaScript (javascript)

Make sure to enable the option “Execute shortcodes” in the ad parameters.

Cotrol ad unit for the AdSense alternative
Create a new control ad unit to put all ads in one consistent layout block and deliver them through one group

Layout adjustments and ad labels

This ad unit calls our ad group with the ID 123 and adds the headline “Advertisement” on top of it. The CSS class textadgroupframe makes sure that there is a horizontal line added before and after the ad group.

The ad label code is only necessary if you don’t use the ad label feature of Advanced Ads but need to mark the links as ads. Without the label, the ad code looks like this:

<div class="textadgroupframe">
	[[the_ad_group id="123"]]
</div>Code language: JavaScript (javascript)

The resulting setup will inject the three ads of your group in a random order in your frontend. Of course, you can put more than three ads in your ad group or create multiple ad groups with numerous controlling ad units.

Optimize the performance of your AdSense alternative

This setup is especially powerful when you work with many affiliate partners. By channeling your affiliate partner text ads through the group served by a controlling ad, you are very flexible in targeting and filtering many ad units centrally.

Your goal should be to improve the click-through rate (CTR). This key value indicates how many visitors who see this ad click on it. You can increase it, e.g., if you only show ads that are as relevant as possible for your visitors.

An illustration visualizing the formula for click-through rate: CTR equals clicks divided by number of impressions

The most crucial tool for ad optimization is tracking. You need this data if you want to measure and improve the performance of your ads.

To track the text links, you need to edit the ad code and insert a placeholder. This manual will show you precisely what this adjustment looks like and what you need to be aware of.

Some suggestions for CTR optimization

  • Try different anchor texts. If necessary, create variants using the Duplicate Ads function.
  • Test different placements.
  • Use display conditions to adjust the inserted ads to the content.
  • Use visitor conditions such as geo-location, browser language, or referrer to customize the ads for different user segments.
  • Test different affiliate programs of the same industry to see if certain brands perform better.
  • Find further tips for ad optimization.

Subscribe to our newsletter and get 2 add-ons for free!

* indicates required
Interests

What else you need to know

If you use caching on your website, you need to enable the Cache Busting to ensure that the rotation of the links within the group works correctly. If you do not inject the text links automatically, but insert them manually, also activate the checkbox. By default, cache busting only works through placements. Enable passive cache busting for all ads and groups which are not delivered through a placement, if possible. You can find it in Advanced Ads > Settings > Pro.

Not all ad networks allow the cloaking or masking of affiliate links. You should disable the click tracking for their text links if you have such partner networks.

The text links of the AdSense alternative are very resistant to AdBlockers. If your AdBlocker is blocking the ads, please try activating the AdBlocker disguise to see if it solves this problem.


Our client Peer Wandiger has built this powerful affiliate marketing setup based on text link ads himself. He provides further insights into his comprehensive AdSense alternative in his user story.

With over a decade of industry expertise, Advanced Ads is your surefooted ally in the ad tech realm. Their array of WordPress ad manager plugins enhances your advertising strategy, ensuring effective ad placements. Rely on their ad tech proficiency to stay ahead in the dynamic world of digital advertising. Contact info

Advanced Ads icon

Make it better

Increase your ad management skills without spending more time.
Join over 150,000 publishers and AdOpts increasing their ad revenue.