How To Cloak Affiliate Links In Blogger

Wanna cloak affiliate links in blogger?

But don't know how to do it.

So, today we have written this guide. In this guide I will tell you everything about Cloaking affiliate links.Some bloggers think that Cloaking affiliate links in blogger is not possible, but they are wrong. Now we have a jquery plugin to help in doing this.


Cloak-affiliate-links-in-blogger

What Is Link Cloaking?

Link cloaking is a process through which you can hide your original affiliate link by URL masking. And link cloaking is very important for any blogger. Because if we will not cloak affiliate links our blog might get penalized by Google.

Can We Cloak Affiliate Links In Blogger
As we know that in WordPress there are many plugins available to Cloak affiliate link. But in blogger, there is no such plugin. So, some blogger experts developed blogger affiliate link cloaking plugin to Cloak affiliate links in blogger.


Why Cloak It?


You are wondering that why should we cloak affiliate links?

Your answer is here, affiliate links include the number, letter, special characters and search engines don't like affiliate links. If you will original affiliate link in your post, your blog might get penalized by Google. So, it is important to do so.

How To Cloak Affiliate Links In Blogger Blogs


1. Login to your blogger Blog Dashboard

2. Then go to Theme >> Edit HTML.

3. Now in code area click anywhere and

press Ctrl + F keys to open the search box.

4. Now search for </head> tag.

5. When you find this tag, just above this paste the jquery code given below:

<script src='http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.js' type='text/javascript'></script>

Note:- If you have already added jquery in your template, then skip this step and follow next step.

6. Now just above </head> tag paste the code given below:

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

 Customization:-

On the above code replace Affiliate Link1 with your original affiliate link like http://hostgator.com/id=Alfaaz

Replace Regular Link1 which affiliate link you want like:

http://yxero.blogspot.com/go/hostgator

Replace all links according to your need

7. Now when you add http://hostgator.com/id=Alfaaz then it will be automatically converted to http://yxero.blogspot.com/go/hostgator


Note:- You can add unlimited affiliate links. Just repeat the same affiliate link code multiple times.


Over To You

This is the way I use to cloak affiliate links. What is your way, share with us in comments. And if you have any problem related to this content comment down and don't forget to share.

Post a Comment

Previous Post Next Post