Techvocast is supported by its audience like you. When you buy through links on our site, we may earn an affiliate commission. Learn more

How to cloak or mask your affiliate link for bloggers

author photo By Published in Last updated on

Ever heard of link cloaking or masking, what's cloaking all about, wondering what it does, well this article will show you how you can cloak any of your affiliate links. Affiliate links can be used through link cloaking, we know that some affiliate link is impossible to remember, so redirecting allow you to create a better and short link that will be easy for you to remember.

link cloaking

But if you copy the link and paste it in another browser tab, the link won't work.

The reason we cloak the affiliate link is to protect our affiliate commission.  It protects your affiliate commissions by making the affiliate ID less visible and makes the link more appealing to visitors.

If a visitor clicks on the affiliate link everything stays on my site until the last minute when they have to be redirected to the original web page. In doing this, there’s less chance for my commissions to be stolen if you were to purchase hosting from this website, with the URL shorten you can have a click count rate about your affiliate link, which redirects to the original link, think that do Wordpress.

The affiliate marketing world is a very competitive place to set up a business.

what're links cloaking? 

Link Cloaking means masking the affiliate link URL given to you by the affiliate program and making the affiliate link shorter, this to obfuscate your affiliate ID and make the link shorter.

For example, this is my affiliate link for socialpilot before cloaking the link: url=dftd2e565

This is my affiliate link for socialpilot after cloaking the link: The affiliate link above goes to the same web page and still track affiliate cookies

The benefits of link cloaking: as we have said earlier before, are to protect your commissions. Link trusted by user and visitor: visitors are more likely to click on the link pointing to the same website they are on than the affiliate link with an ugly face, cloaking affiliate links still leads to increased click-through rate.

By cloaking my affiliate link, I can set what the URL will look like, so instead of a link to the product page with random numbers and product IDs that make no sense to my audience, I can change the slug of the URL to match whatever I like.

If the product like is something like this:, if this URL was cloaked I could say and the link will still lead to the product page. As an affiliate marketer, you will have a lot of links to cloak.

Cloaking your affiliate links in Wordpress is done with the help of an affiliate link management plugin, like ThirstyAffiliates and PrettyLink that gives you many other side benefits. But we ain't talking about the Wordpress plugin, this tutorial is about blogger on how to implement the jquery code for the link cloaking to work, you should have known that they are no such plugin or widget for blogger blog so today I will teach you, how to cloak your affiliate link in blogger blog.

How to cloak your affiliate links

Cloak your link with this simple and easy code, With a little short of Jquery code, you can be able to cloak your link.

Go to your theme section click edit and tap anywhere then tap CTRL F your search box pop up and search for the closing head, then copy and paste the below Jquery just above the closing head on your blogger Blogspot template
<script src='' type='text/javascript'></script>             <script type='text/javascript'>var aff = new Array();
/* define your links here */aff['Your affiliate Link1'] = '';
aff['Your affiliate Link2'] = '';
aff['Your affiliate Link3'] = '';
aff['Your affiliate Link4'] = '';
aff['Your affiliate Link5'] = '';
/* do not edit below this point */
/* reverse the key/value pairs so we can lookup based on value */var aff_reverse = new Array();for (k in aff) {    aff_reverse[aff[k]] = k;}
/* scan all links when the document loads */$(document).ready(function(){  $('a').attr('href',function(){        /* if the link isn't listed above, do nothing */    if (!aff[$(this).attr('href')]) {return $(this).attr('href');}    /* ok, the link is in our list */    $(this).click(function(){        /* when the link is clicked on, revert it back to the affiliate link */        //$(this).attr('href', aff_reverse[$(this).attr('href')]);        return true;    });    $(this).mouseup(function(){        /* Firefox ignores onclick event when the link is opened via middle mouse (new tab) */        $(this).attr('href', aff_reverse[$(this).attr('href')]);        return true;    });    $(this).mouseout(function(){        /* revert back to non-aff link in case they opened in new tab */        $(this).attr('href', aff[$(this).attr('href')]);        return true;    });    /* change the affiliate link to a non-affiliate link */    return aff[$(this).attr('href')];  });});</script>
Edit the Jquery code

In the above code, find aff[‘Your affiliate Link1‘] = ‘Your regular Link1‘; and then Replace Your affiliate Link1 with your affiliate link; URL dftd2e565

Replace Your regular Link1 with a simple link like

Just like this

aff[‘ url dftd2e565‘] = ‘‘;

when you add the affiliate link url dftd2e565 on your blogger post page or the html/javascript widget then it be converted into

Remember you must add the original affiliate link for it to work, you can add unlimited link as you want just copy and paste this

aff['Your affiliate Link5'] = '';
If you have any problem in setting it up comment below and we guide you through. Like this article share with friends.