Affiliate Link Cloaking – Two Efficient Ways to Cloak Links on Your WordPress Site

Affiliate Marketing
A-Complete-Guide-to-Affiliate-Link-Cloaking-Banner

Overly lengthy affiliate links are a common problem faced by affiliates, especially those who are new to the game. After all, how do you get users to click on these long links?

Thankfully, the solution is quite simple: affiliate link cloaking. By “cloaking” a link, you will make it cleaner, and what’s more, personalize it according to your branding. It’s imperative if you sell affiliate products on your website.

Affiliate link cloaking offers a plethora of benefits, the most significant of which are clean, identifiable links. Here’s everything you need to know about using them.

What is Affiliate Link Cloaking?

As you can probably guess from the name, link cloaking refers, literally, to “cloaking” the original link and disguising it so it looks simpler. Think of it as a way of cleaning up the links.

People generally avoid clicking on overly long links in the first place. They can seem shady, and your audience can find it hard to deem them “trustworthy.”

Thus, affiliate link cloaking improves how links are presented on your website. And remember, if you are using affiliate links, you also need to write and add appropriate affiliate disclosures.

The Major Benefits of Using Affiliate Link Cloaking

Affiliate link cloaking offers a number of advantages to marketers promoting their services for a more reliable image.

User-Friendly Affiliate Link Management

If you are working with multiple affiliate programs, managing those lengthy links can seem difficult. But cloaking them and personalizing these offers a simple solution to easily managing multiple links together.

Say you want to generate more traffic for your Cloudways affiliate program. If you don’t use link cloaking at all, you’d have to access the Affiliate Panel, find your unique ID, and then add it to any post.

Cloudways Unique Affiliate Link

Cloudways Unique Affiliate Link

But by using a plugin, you can just add the link directly while you are editing the post in WordPress. It’s so much better than using those long ugly links provided by different affiliate programs. Here’s a good example from ThirstyAffiliates:

Cloudways affiliate link

Easy to Share

Another major advantage of using link cloaking is that it makes your links very easy to share – an invaluable property for affiliate marketers.

When they are small and easy to manage, they automatically become more shareable.

Convenient Link Tracking

Tracking the traffic from different links becomes much easier with affiliate link cloaking.

You will be able to figure out which links are generating more traffic. By analyzing the content and the context where these links have been added, you can optimize others accordingly to maximize the effectiveness of your affiliate programs.

How to Cloak Affiliate Links in WordPress by Using Thirstyaffiliates

Cloaking affiliate links in WordPress is actually quite simple, and you can easily do it through a third-party plugin like ThirstyAffiliates. It’s one of the best affiliate marketing tips because it saves a great deal of time. Here’s our step-by-step tutorial on cloaking links in WordPress.

1. Select a Prefix

The first step is to select a prefix for your affiliate links. The link prefix is essentially the part that is sandwiched between the link slug and the domain name. For instance, it could be something like yourwebsite.com/promotes/cloudways-hosting

2. Add Links

Once you have installed Thirsty Affiliates, you can add individual links to the plugin in order to cloak them. At the top, you need to add a title. Then, add the URLs and the destination. For instance, if you are using the Cloudways Affiliate Program, setting the destination is easy by just copying your unique affiliate ID.

Add Links

3. Insert the Cloaked Links

You can insert your cloaked links successfully into your content through the WordPress dashboard through a straightforward prompt that shows up in the dashboard, as shown below:

Cloaked Links

Can You Cloak Affiliate Links Without a Plugin?

Yes, you can also do that. Here’s our simple guide for cloaking affiliate links without using a plugin.

Step 1: Create a New Folder

First gain access to your server. You can do this using any FTP client like FileZilla. It will look something like this when you access the main directory on the server:

FileZilla

You can then create a new folder on the server. Name it something like “affiliate links.”

Step 2: Upload the index.php File

Then, create another file entitled index.php and add the code as given on Yoast’s GitHub repository.

<?php
 
$id  	= isset( $_GET['id'] ) ? rtrim( trim( $_GET['id'] ), '/' ) : 'default';
$f	= fopen( 'redirects.txt', 'r' );
$urls	= array();
 
// The file didn't open correctly.
if ( !$f ) {
  echo 'Make sure you create your redirects.txt file and that it's readable by the redirect script.';
  die;
}
 
// Read the input file and parse it into an array
while( $data = fgetcsv( $f ) ) {
  if ( !isset( $data[0] ) || !isset( $data[1] ) )
    continue;
  
  $key = trim( $data[0] );
  $val = trim( $data[1] );
  $urls[ $key ] = $val;
}
 
// Check if the given ID is set, if it is, set the URL to that, if not, default
$url = ( isset( $urls[ $id ] ) ) ? $urls[ $id ] : ( isset( $urls[ 'default' ] ) ? $urls[ 'default' ] : false );

if ( $url ) {
  header( "X-Robots-Tag: noindex, nofollow", true );
  header( "Location: " .  $url, 302 );
  die;	
} else {
  echo '<p>Make sure yor redirects.txt file contains a default value, syntax:</p>
  <pre>default,http://example.com</pre>
  <p>Where you should replace example.com with your domain.</p>';
}

Step 3: Add the Links in the Redirects.txt File

Once you have added the code, the next step for affiliate link cloaking is to create a new file. Name it redirects.txt. Essentially, you can add the destination URL as well as the link slug here.

The format is as follows:

Website-slug, https://destinationlink.com/affiliateid=987

Then give a line break, and add each affiliate link in a separate line:

Website-slug, https://destionationlink.com/affiliateid=987

Cloudways, https://cloudways.com?cloudid=389

Step 4: Block Crawlers

You don’t want Google or other search engines going through your redirects. To prevent that from happening, it’s best to add a rule to your robots.txt file. Just open the robots.txt file and add a rule:

Disallow: /affiliate-links/

This is the name of the folder you create in the root directory.

Are you a developer?

Earn Upto 15% recurring commission + CPA per Referral With Cloudways Affiliate Program.

Top 3 Affiliate Link Cloaking Plugins

Now, if you want to use plugins, here are the top three that you can choose for your website.

1. ThirstyAffiliates

Thirsty Affiliates is one of the oldest players in the game and allows you to cloak links (tutorial given above) directly from your WP Dashboard.

2. Pretty Links

Pretty Link is another plugin used for link shortening, especially for custom links. It’s a great way to clean up your affiliate links and cloak them according to your preferences.

3. Simple URL

Simple URL is another link shortener that works seamlessly with WordPress websites. It’s a clean affiliate link cloaking plugin that you can use on your WordPress website to shorten the links.

Bottom Line 

This is a simple yet effective guide to cloaking affiliate links on your website. Using a plugin is obviously the easier option because it reduces time considerably. It also makes it easy for affiliates to streamline the different links that they use to promote certain programs.

Grow Your Income with Our Affiliate Program

Join, Promote, and Earn. It’s That Simple!

Usman Dar

Usman is a Digital Marketer at Cloudways- A Managed Cloud Hosting Platform, where he looks after affiliate partnerships and helps digital nomads in generating passive income.
He is a foodie by heart, who loves to explore new eateries around his vicinity.

×

Get Our Newsletter
Be the first to get the latest updates and tutorials.

Thankyou for Subscribing Us!

Leave a Reply