How to Cloak An Affiliate Link

In this blog entry, I gave you the low down on the PowWeb Affiliate Program and how easy it is to earn a lot money for virtually no effort.

One suggestion I had was for affiliates was to cloak their affiliate link. Here are just are a few reasons why cloaking your affiliate link is beneficial:

- It helps deter affiliate link hijacking
- You can use cloaking to make an easier to remember link
- It makes your link cleaner and prettier for your readers

Link cloaking isn’t a new idea. Guess who else is using it? Google. Anytime you do a search in Google, they show you the advertisers “Display URL”. The Display URL is a nice and clean public-facing url that the advertiser has chosen.

KGoogle Adwords Link Cloaking

If you ever want to see the “real” url of an ad, right click on the title of an ad and go to copy shortcut. If you paste it somewhere, you’ll see that the ad is really going to some long arbitrary url like: google.com/?cp=ADFDGH0GbveRRGHvvweREZMeRTW

It doesn’t stop there. Google then redirects that long ugly url to the advertisers url of choice. This could be an affiliate link which then redirects the end user to the final location.

So for a lot of our affiliates advertising PowWeb in Google, this is what is going on:

User does a search > they see a pretty url such as powweb.com > they click on the link > the link goes to google.com/?cp=ADFDGH0GbveRRGHvvweREZMeRTW > which then redirects to the affiliates url such as: http://www.powweb.com/join/index.bml?AffID=565198 > which finally redirects to powweb.com.

So as you can see, both Google and the affiliate are using some form of link cloaking!

There are several ways of cloaking your affiliate link. Here are a few you might be interested in.

1. HTML Meta Redirect Method

This method utilizes a meta refresh to redirect a file on your hosting account to your affiliate link.

Here’s an example:

Let’s say we want to redirect traffic using a meta refresh from your site using the url http://www.myawesomedomain.com/powweb to your affiliate link: http://www.powweb.com/join/index.bml?AffID=565198

The first step would be for you to create a web accessible folder called “powweb”. For most PowWeb customers, you would create this folder within htdocs.

The second step is to create an index file to drop in the folder. The index file will contain the actual meta refresh.

Here is how it works:

When someone accesses http://www.myawesomedomain.com/powweb, the web server will serve up the index file within the powweb directory you created. Within the index file is some html which tells the browser where to redirect and when.

Here’s the fully valid code for our example:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
<html xmlns="http://www.w3.org/1999/xhtml">
 
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
	<meta http-equiv="Refresh" content="0;url=http://www.powweb.com/join/index.bml?AffID=565198" />
	<title></title>
</head>
 
<body>
 
</body>
 
</html>

You can download this example by right clicking on this link and doing a “Save Target As.” You’ll need to edit the url within the code so that it redirects to your affiliate url.

2. .htaccess method

By using .htaccess, you are essentially telling your host/web server what to do with a url request before it serves any file. This is a little different from the aforementioned meta refresh which is processed by your browser after the page has already been served.

To use the .htaccess method, you still need to create a web accessible folder.

Remember our example. We’re trying to redirect http://www.myawesomedomain.com/powweb to your affiliate link: http://www.powweb.com/join/index.bml?AffID=565198.

It doesn’t have to be powweb though. If you wanted to direct customers to your affiliate via http://www.myawesomedomain.com/whatever, then the folder you would create would be called “whatever”.

Once the folder is created, you’ll want to drop in an .htaccess file.

Here is the code I created for this example:

1
Redirect /powweb http://www.powweb.com/join/index.bml?AffID=56519

/powweb is the name of the directory you want to redirect, and the url is your affiliate link.

3. PHP Header Redirect Method

This method utilizes php to redirect the end user to your affiliate link. Again, you’ll need to create a directory and drop a php file within that directory for this to work.

Here is the code for this example:

1
2
3
<?php
header("Location:http://www.powweb.com/join/index.bml?AffID=565198");
?>

There is only one part you need to modify, and that is the url string. You should replace it with your own affiliate link.

Conclusions

You can actually take these examples to another level and create a dynamic database-driven system which automates a lot of the link modifications for you. By doing so, you save a lot of time (if you are dealing with a lot of links) and make adding in additional features, such as a link tracking, easier.

Link cloaking isn’t always necessary, but it can definitely come in handy. In some cases, PHP or .htaccess may not always be available options so you’d want to use the meta refresh. Choosing which method to use really depends on your own unique situation. If you aren’t going to do much more than what I’ve mentioned above, then it’s really a matter of preference.

I did my own testing and the PHP method redirected the fastest. Hope this helps.


6 Responses to “How to Cloak An Affiliate Link”

  1. Powweb review Says:

    Link cloaking serves it’s purpose in some cases but most of the time users won’t “link hijack” you because they will give you credit for the valuable content you provide. Besides, if someone is IT savvy enough to recognise an affiliate link they will most likely be smart enough to recognise the different redirection methods before clicking.

  2. Croc Says:

    Joshua, can you give us some statistics to support the benefit of cloaking an affiliate link? Personally I feel it’s being dishonest. I do not like being redirected and will close the browser. However, if I am going to sign-up somewhere I’m happy to benefit an existing customer if possible. Can you give us any real stats on the most successful method?

    I imagine a review with a “I can help you here and get a kick back if you sign-up by clicking this link.” would be most successful. Can you throw some factual numbers up there to help us target our audience and get you more referrals.

  3. Joshua Says:

    I’ll agree that link-cloaking isn’t the best way of attracting customers and that it has been used for deceptive practices, but it the situations mentioned above, it is not dishonest to hide your affiliate link. Why does anyone need to know your making a commission off people who sign-up through your links? I would say most people don’t really care/know what an affiliate link is. Being honest about getting a kick-back is only going to appeal to the camp who values you being honest that your making money from the referral — as if there is something wrong with doing so! It would; however, be dishonest to say, “The only way someone can sign up a new account at PowWeb is through your link.” You are then deceiving the customer into thinking that your link is the only way to get an account at PowWeb — which obviously isn’t true.

  4. Ryan Says:

    Of course cloaking your affiliate link is dishonest and deceitful. In most cases, people who publish an affiliate link do it after promoting or reviewing a product. Generally for products they review favorably.

    Not disclosing that you’re receiving payment from a company for a product or service you are reviewing runs on the hairy edge of illegal (see: http://www.washingtonpost.com/wp-dyn/content/article/2006/12/11/AR2006121101389.html?nav=rss_technology). It’s not *always* illegal, and that’s not the only use of affiliate links, but it’s certainly the most common.

    You give up some of your credibility/honesty when you omit the fact that you’re reviewing a product you get a kick back for. That’s why there’s such an uproar over a service like PayPerPost, which, until recently, didn’t ask it’s users to disclose they were getting paid for their favorable reviews (see http://www.techcrunch.com/2006/12/16/payperpost-does-something-right/)

    Can you cloak your links? Sure.

    Should you? No. If you’re not embarrassed or intentionally obscuring your relationship, you should be honest with your readers that you’re being incented to provide a review/link/pitch and not hide your affiliate relationship.

  5. Joshua Says:

    I don’t at all disagree with everything you’ve said; especially when it comes to the legality of making sure you disclose that you’re receiving payment from any company you are reviewing. There’s nothing worse than when a product review site (like pricegrabber.com) is ruined by competing companies adding their own positive reviews and dogging others.

    When I wrote this blog, my intention was to provide insight into the cloaking methods used ad infinitum on the web today. Does it make you feel better if I call it “url wrapping”? PowWeb’s been using “wrapping “ forever.

    When we wanted to track the success of our Spice advertisement in Wired Magazine, we created http://www.powweb.com/spice and had that redirect to an affiliate link which redirected to the PowWeb homepage. What moral or ethical code are we breaking by not telling customers that we’re going to be cloaking a tracking url used to measure the success of our advertising dollars?

    When a grocery store uses your average keychain discount card to track your spending habits so that they can determine the most amount you’re willing to pay for dish soap, are they scamming you?

    Would anyone use the keychain if the keychain was really a big paper form that asked which products you bought, when, and for how much? Probably not. They’re a business and it’s there right to at try and make the most money they can. If people don’t like being tracked, they don’t have to use their card. If the price of the soap is too high, they don’t have to buy it. And if they’re just not into commercially-sold soap to begin with, they can make their own. The same rules apply for the net.

    Back to the spice ad. Would anyone have went to our Web site from the print ad if the url they had to type in was http://www.powweb.com/join/index.bml?AffID=565198? Nope. It’s hard enough to get them to type in http://www.powweb.com/spice.

    “Can you cloak your links? Sure. Should you? No.”

    The answer to should you cloak your links isn’t a simple yes or no answer. It really depends on the situation and to what end one hopes to achieve by doing it. Cloaking a link for tracking or for marketing (making an easy-to-remember url) is almost always OK in my book. Cloaking a link to deceive customers is not.

  6. RichBeaver Says:

    I’ve wrote a small article dedicated to easy cloaking methods using JavaScript and PHP for others that are not so good with programming
    http://richbeaver.com/webmasters/link-cloaking-step-by-step-guide/

Leave a Comment