Skip to main content

Affiliate link Cloaking Widget For Blogger

affiliate cloaking for blogger

Hey there, Happy Sunday to you!
This is a Sunday exposure...
It's happy blogging time, I hope you enjoy every bit of what you get in here...

So, today, I'm going to be exposing something really cool and not so hard to implement...
Do you run your blog with few affiliate linkings? and sometimes get bored of the long ugly affiliate link your readers get to see while they click a link on your blog?
or you are so bothered that you wish you can hide your affiliate links so your readers don't bypass your links...
Well, some readers are like that! "you can't refer me!".

WordPress have got this plugging and you can Read about the best affiliate link cloaking Plugins For Wordpress...

Unlike wordpress, as you know, blogger interface is missing this and many trials to get an affiliate link cloaking widget have proved rather uneasy...

I bet, I should call you lucky; because, it took me lots of findings to finally bump into a working affiliate link cloaking add-on for blogger! it works, probably not like wordpress, but it definitely works...

Here is what to do
1. As always, Back up your blogger template
2. Add this Jquery code just below <head> in your template file.
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.js" type="text/javascript">

3. Now Search for </head>  and paste the code below just above it.
<script>
var aff = new Arrayundefined);

/* 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 Arrayundefined);
for undefinedk in aff) {
    aff_reverse[aff[k]] = k;
}

/* scan all links when the document loads */
$undefineddocument).readyundefinedfunctionundefined){
  $undefined'a').attrundefined'href',functionundefined){
    
    /* if the link isn't listed above, do nothing */
    if undefined!aff[$undefinedthis).attrundefined'href')]) {return $undefinedthis).attrundefined'href');}
    /* ok, the link is in our list */
    $undefinedthis).clickundefinedfunctionundefined){
        /* when the link is clicked on, revert it back to the affiliate link */
        //$undefinedthis).attrundefined'href', aff_reverse[$undefinedthis).attrundefined'href')]);
        return true;
    });
    $undefinedthis).mouseupundefinedfunctionundefined){
        /* Firefox ignores onclick event when the link is opened via middle mouse undefinednew tab) */
        $undefinedthis).attrundefined'href', aff_reverse[$undefinedthis).attrundefined'href')]);
        return true;
    });
    $undefinedthis).mouseoutundefinedfunctionundefined){
        /* revert back to non-aff link in case they opened in new tab */
        $undefinedthis).attrundefined'href', aff[$undefinedthis).attrundefined'href')]);
        return true;
    });
    /* change the affiliate link to a non-affiliate link */
    return aff[$undefinedthis).attrundefined'href')];
  });
});
</script>


Cloaking your Affiliate Links
Your affiliate links won't get cloaked just by adding the above to your template file, you need a little customization to get your affiliate links cloaked...

Now to make this work, In the above code, find aff [' Your affiliate Link1'] = ' Your regular Link1 '; and then replace Your affiliate Link1 with your affiliate link
eg. http://affliatelink.com/id=affliate
and then replace your regular Link1 with the simple link that you desire. it is advised that you use your site link.
eg. http://yoursite.com/go/affliate
once you replace the affiliate link as explained above, if you click  http://affliatelink.com/id=affliate in your blog post page, it will automatically look like http://yoursite.com/go/affliate before redirectibg o your supposed affiliate site...

Note that you need to add the real affliate link to your post page, else this won't work.
You can create as many cloak affiliate links as you want

Comments

Popular posts from this blog

#Day2: Overcoming Procrastination

Have you ever tried getting rid of procrastination but find yourself procrastinating about doing what's needed to be done? # Day2 of my 30 days on a Confused State of Mind. Today, it's about overcoming my biggest struggle, Procrastination. In case you missed #DAY1 Of my Confused State of mind, You can go read it >>>>  Discovering my self-worth 99% of times, I find myself procrastinating but worrying over the fact that I can't fight it! Like whom ever said I couldn't fight it? It's a rough fight and I'm always at the losing end. I feel bad about the fact that I go through this but I'm not ashamed to admit it. Probably spiting it out is one of the ways I've got to fight it. Who Else Rows the Boat? The act of postponing and procrastinating isn't peculiar to me, definitely there are a lot more people out there struggling even worse than I. But it doesn't matter, because we are all birds of a feather!  Obviously, it feels so bad to b...

Earn While you Save With Alat.ng

If you've always wanted to save up for the future, but didn't take actions for reasons best known to you, now is the time to reconsider your thoughts and take actions, because there is a digital bank known as ALAT waiting to be utilized. What Is A Digital Bank? According to Avoka.com; "Digital banking is the digitization (or moving online) of all the traditional banking activities and programs that historically were only available to customers when physically inside of a bank branch." What is ALAT? ALAT is a digital bank, the first if its kind in Nigeria! It is an innovation of Wema Bank Nigeria, developed to give you easy access to saving your funds and doing other bank transactions without being physically present at the bank.  With Alat digital bank, you can open a savings account using your phone number and Bank Verification Number (BVN) as well as other documents that you will be prompted to upload during the registration process. It’s simple, convenient, reliabl...

How To Expand Your Wordpress Ping List

WordPress ping list are indeed useful when you want to extend your blog reach to major search engines. If you are not aware of pinging feature in WordPress, then be aware now! :) When ever you publish, edit or modify a post, WordPress sends ping to all the Ping services which must have been listed under your ping update service. So this way, ping services get notified about new post and search engine will quickly index them. Now by default WordPress notifies all major ping services but we can always extend our limit by pinging more services. adding them manually is an option definitely.  Below is a list of ping services for WordPress , which will help you to ping more services. You can also copy the list from WordPress doc file http://rpc.icerocket.com:10080/ http://blogsearch.google.com/ping/RPC2 http://1470.net/api/ping http://api.feedster.com/ping http://api.moreover.com/RPC2 http://api.moreover.com/ping http://api.my.yahoo.com/RPC2 http://api.my.yahoo.com...