Link Cloaking is one important thing you should do if you are into an affiliate marketing or going to start it now. There are certain reasons for doing it. But, before knowing the reasons to cloak affiliate links, let us know what affiliate links are and what is affiliate link cloaking.
What is an Affiliate link?
An affiliate link is a unique referral link assigned to you. It helps the merchant to track the sale of a product or service that has been come from your website. In short, an affiliate link is nothing but a referral link.
Example of an affiliate link: http://www.affiliatesite.com/products/?product_id=1234&affiliate=1234
What is Affiliate Link Cloaking?
The dictionary meaning of cloaking is covering or hiding or wrapping. So, the hiding of your referral or affiliate link is Link Cloaking.
Why should I Cloak Affiliate Links?
Below are the few reasons and advantages you get by cloaking your affiliate links:
- Offers Clean Links: Affiliate links are usually lengthier and uglier. Without doing a copy/paste job it’s even impossible to remember.
- Ease of Maintenance: Maintenance becomes easy. For example, if the merchant decides to change networks or linking methods, how do you edit every single redirect? Cloaking links eliminates the need to edit every instance in which you linked to them throughout your entire site. The same applies if you decide to change the merchant you’re going to promote for a product.
- Avoids PageRank leaks to advertisers: Affiliate links are advertisements and should not be followed. On the other hand they should be altered to prevent PageRank leaks to the advertisers. You can do this at one place instead of doing manually for every individual affiliate link.
- Takes care of nofollow tag: In addition to the above benefits cloaking plugins/script takes care of adding nofollow tag to all of your links.
How to Cloak Affiliate Link?
It’s simple. Just use another URL in the place of original affiliate link. Next, redirect the visitors to affiliate link once they click on the masked link. Feel difficulty and wonder how to do it? Follow one of the below mentioned two method.
1. Use Plug-ins to get the job done:
If your blog or website runs on WordPress, there are a wide range of plug-ins available in market both for free and payment. Be wise while choosing the free versions. Most of the free versions provided by those plugins do not offer import and export support for your affiliate links. If you are new to affiliate marketing then you may not need to worry at the moment. But, it is very important. Once your blog or website grows in time, you will definitely have more affiliate links. Now, assume your current plugin provider stops releasing new versions or stops development or just you are no longer interested in using it. How do you switch or migrate to the other plugin provider without import? In such cases, you either need to upgrade to the premium version of a plugin or manually update each affiliate link.
In order to solve the above problems with plugins you can choose the second method for cloaking affiliate links.
2. Cloak the links manually:
How to Cloak Affiliate Links without a Plugin?
Cloaking affiliate links manually or without a plugin requires a bit technical knowledge. This method is taken from Yoast’s post on affiliate link cloaking.
Cloaking affiliate links manually is simpler and faster. On the other hand it helps you serve your redirects from the desired location. So that your blog and main website or landing page can run on two different technologies. WordPress being installed on a subdirectory doesn’t allow you to serve redirects from your preferred location. This can make the slug/permalink a bit lengthier. Example: example.com/blog/recommends/affiliatelink.
Cloaking affiliate links manually requires three files on your server.
1) index.php: This file contains the actual logic to handle the redirections by performing a 302 redirect. Additionally, it sends X-Robots-Tag header to ensure search engines that can detect this header, and follow the noindex, nofollow rules we pass along in it. This acts as an extra security measure in case if you forget to exclude the affiliate link in robots.txt file.
2) Redirects.txt: The redirects.txt file is a comma-separated file. It contains a list of names and destination URLs / affiliate links.
3) .htaccess (optional): Creating the above two files is enough to start cloaking website URL. Adding this file just prettifies the URLs listed in redirects.txt. In addition, this file ensure people can’t access your redirects.txt file. So that they can’t have a look at what affiliate links are available.
The process of link cloaking starts by creating a folder at the location from where you wish to serve your redirects.
Step 1: Go to your preferred location. For example domainname.com.
Step 2: Create a folder and rename it choice of yours. The most commonly used slugs/words used in affiliate marketing are go, out, refer, recommends etc. Try to keep it short because the shorter is always easy to remember and key in. At InfoSeekOut we use /go/.
Step 3: The next step is to block search engines from following and indexing of affiliate links that are listed under /go/ folder. To do it, just add the following line to your robots.txt file – Disallow: /go/
Step 4: Create a file index.php and paste the redirection code or download it from here.
Step 5:At this step we create redirects.txt file and place the affiliate links one in each line. Before that enter the following line at the very top – default,http://example.com (replace example.com with your own domain) of a file and it should always contain no matter of what. This ensures redirection is done to a default in case the people attempts to enter or clicks a non-existing URL.
Step 6: This is the last that has to be done and it’s an optional. Create an .htaccess file. It is to prettify the URLs and increase the readability. Without prettifying your URLs, you’ll end up with something like /out/?id=infoseekout instead of /go/infoseekout.
How to create .htaccess file?
Before getting into how to create .htaccess file, let us know what it is.
What is .htaccess files
An .htaccess file is an instruction file that instructs server how a WEB-ADMIN wants to give access to a directory of file.
The file can be used for the following functions:
- Controlling the access of the directories.
- Rewriting URLs and blocking particular IP addresses
- Reconfiguring account settings.
- Creating redirects, and much more.
It is important that you should place .htaccess file in a folder of your site from where you want to manage. For example, if you want to manage the folder /go/ in www.example.com place it in there. That is to say, .htaccess file should be in www.example.com/go/.
As soon as the file is placed in desired folder, it revokes access to that folder.
Step 1: Open a text editor like notepad in Windows and Copy and paste the code or download it from URL mentioned above in Step4.
Step 2: Save the file with any filename like ABC.htaccess.
Remember: Filename must be listed before .htaccess extension. This is because, without filename windows operating system will not allow you to create a file.
How to rename ABC.htaccess to .htaccess?
It’s easy. Open the command prompt (press Windows Key + R).
Type the word cmd and hit enter. It opens command prompt.
Enter the following command – ren “D:\ABC.htaccess” .htaccess. (Here D:\ABC.htaccess is the location of a file and ren stands for rename).
That’s all. Now you have successfully created the .htaccess file. Upload the file to desired location using FTP clients or direct upload option.
Note: The file goes into hidden as soon as it’s placed into the folder on server.
What are the advantages and disadvantages of manual link cloaking?
- Non-plugin solution is faster because it doesn’t depend on technology like WordPress to run.
- Doesn’t allow you to collect statistics on your affiliate links. You might have to depend upon Google Analytics Event Tracking.
- Have to manually edit the txt file each time that you want to add/edit a new affiliate link.
What about cloaking plugins?
Speed: The speed of URL redirection is a bit slower with plugins. This is because the plugins depend on WordPress’ core code. So they need to wait for it to be fully booted before being able to execute themselves. As a result, it can easily increase loading and redirecting time by a second or two in total if you’re on a slow server.
Ultimately, the best option depends on your requirements. If your preference is faster redirection just use the redirect script or else go for plugins.