-->

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.

Howto/

1. First of all, copy and paste the below Jquery plugin just above the closing </head> on your blogger Blogspot template.
         
<script src='http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.js' type='text/javascript'></script>

2. Now, copy and paste the below code just again above </head>
             
<script>
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 */
$(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>


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. http://hostgator.com/id=vishal

Your regular Link1 with a simple link i.e. http://hugestreet.info/go/hostgator

Now when you add affiliate link i.e http://hostgator.com/id=vishal on your blogger post page then it automatically be converted into http://hugestreet.info/go/hostgator

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.

Offer:
  Get Google Apps for work for free for 1 month.


Related Posts

Post a Comment

Subscribe Our Newsletter