How To Cloak, Mask Affiliate Link on Blogger Blogspot


Oh! after a long time, Jquery plugin is here to hide and cloak our precious affiliate link. The most important plugin ‘GoCodes’, which is available for WordPress helps the blogger to hide their affiliate link. And, due to the limited feature of blogger, No one was able to create this plugin.

Credit:- A lots of thanks to ragepank to create this plugin for fellow bloggers.


1. First of all, copy and paste the below Jquery plugin just above the closing </head> on your blogger Blogspot template.


<script src='' type='text/javascript'></script>

2. Now, copy and paste the below code just again above </head>

var aff = new Array();

/* define your links here */
aff['Your affiliate Link1'] = 'Your regular Link1';

aff['Your affiliate Link2'] = 'Your regular Link2';

aff['Your affiliate Link3'] = 'Your regular Link3';

/* 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 */

/* 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 */
/* when the link is clicked on, revert it back to the affiliate link */
//$(this).attr('href', aff_reverse[$(this).attr('href')]);
return true;
/* Firefox ignores onclick event when the link is opened via middle mouse (new tab) */
$(this).attr('href', aff_reverse[$(this).attr('href')]);
return true;
/* 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')];

3. How to customize:

On the above code, find aff[‘Your affiliate Link1‘] = ‘Your regular Link1‘; and then replace

Your affiliate Link1 with your affiliate link i.e.

Your regular Link1 with a simple link i.e.

Now when you add affiliate link i.e on your blogger post page then it automatically be converted into

Note: On the Jquery code(step 2) you can see, I have added three bold text. That means you can create many cloak affiliate link.

Read: Comment below. I love to answer. And keep share it with your blog readers and don’t forget to give credit to ragepank for this awesome plugin and Hugestreet.

  Get Google Apps for work for free for 1 month.

Leave a Reply

Your email address will not be published. Required fields are marked *