Affiliate marketing is a great introductory way to make money from a blog, and you don’t even need a huge amount of traffic to pull it off. It’s typically higher paying and more effective than traditional advertising, and it scales well with increased traffic and a broadening niche. In fact, you can scale it up to be a million-dollar annual business at the highest levels, though that’s a matter of a decade of growth, not a year or two.
Affiliate links are tricky to use properly, however. You need to mark them clearly, both because of potential Google penalties and because of international financial laws. Thankfully, one thing you can do to help minimize their impact and maximize your profits is cloaking them.
Cloaking an affiliate link means hiding its true nature from people clicking it. Some people avoid clicking affiliate links out of spite, but will click links that don’t look like affiliates. Some forms of cloaking are black hat and can hurt your site, but if you cloak the right way, you can stay SEO friendly while still getting that bump in profits.
Cloaking is a tool, and like any tool, people use it for both good and evil. There are some legitimate reasons to cloak your links, but there are also some that just show your intent as a spam marketer.
If you’re hiding the true nature of your links because otherwise no one clicks it, you’re probably spamming and you’re not helping your case by cloaking them.
If you’re hiding the true nature of your links because users are redirected through several ad networks and offer sites before reaching their destination, that link is very clearly spam and harms the user experience. This is an awful technique, makes very little money, and you aren’t hiding anything from Google.
If you’re hiding the true nature of your links so you can send bots to one destination and human users to another, Google considers you cloaking for a malicious reason and will penalize you for doing so. This is also a bad technique, and while it’s harder to catch, it’s still obvious to some bots and will hurt you in the long run.
So what are the legitimate reasons to cloak your links through an outbound script?
You might have seen me refer to this as an outbound script rather than a cloak. Cloaking the link, really, is just a secondary side effect of the method we’re putting into place. Additionally, it primarily works on sites you created on your own; you can use plugins to achieve the same effect on WordPress without the hassle, for example.
The first thing you want to do is create an outbound folder. This will be a folder in the root directory of your site, usually just called /out/ or something similar. In practice it doesn’t matter what it says, just so long as you know what it is. By root directory, I mean www.example.com/out/. You can hide it deeper in sub-directories, if you really want, but that will involve modifying scripts.
If you want, you can create several folders, one for each major affiliate network you use. This will necessitate using several different scripts, customized for each outbound directory, but it will make your links look a little better when it’s something other than just /out/. Consider it something to assist with converting people who filter their clicks heavily. It might not be worth the time to invest in it.
The second thing is to hide that folder from scraping and from the likes of Google. A lot of your links are going to point to it, so sooner or later Google would crawl it. Given that it will be full of a bunch of redirection scripts that are pretty much solely used for cloaking, you don’t want Google looking at it. There’s nothing inherently wrong with it, it just isn’t something that needs to show up in search results.
To hide that folder, all you need to do is go to your main site robots.txt file. If you don’t have this file, it’s easy to create; just create a new .txt file in notepad. In that file, type:
Then save the file and put it in your root directory, so that it is visible when someone types www.example.com/robots.txt.
The cgi-bin and tmp folders are typical folders full of system files that don’t need to be indexed or added to search results. Usually Google will ignore them, but not necessarily, so it’s a good idea to disallow them. You can disallow any folders of similar unnecessary content depending on your site structure. If you don’t actually have a www.example.com/cgi-bin/ folder, you don’t need that entry on the list; just remove the line. Obviously, if you have multiple subfolders for different links, add each of them to the list on its own line.
There’s more customization you can do with robots.txt, and you can read about it here. The main point is to never under any circumstances type “Disallow: /” and save the file. This will disallow search engine crawling on your entire site, effectively removing you from the search rankings entirely. You don’t want that to happen.
The third step is to create a PHP redirect script. I recommend using this one created by the Yoast dev Joost de Valk. It’s well-developed and well-commented if you need to modify it in any way.
It is essentially three scripts, though only one of them has any serious meat to it.
The important tags to keep in there is the default tag. Make sure that one is your site homepage. That way if someone clicks on a link with a tag that doesn’t work, they’re redirected to your homepage. Same with the sitename example. Keep those so that people can’t navigate to the redirects file itself.
Now when you want to link to an affiliate site, you will just want to make the URL a format like www.example.com/out/?id=IDNAME. The IDNAME is your reference, like the default entry’s is “default.”
The process for adding a new affiliate offer, then, will look like this:
Now, there’s one more thing you want to do. Remember those people who look for affiliate IDs on their URLS? They’re going to see your ?id=IDNAME tag and consider that one just as bad. They don’t like anything that comes after a ? in your links. To Google, it’s also a sign of cloaking, so you want to hide that sign as well.
The way you do this is modifying your .htaccess file, or creating one if you don’t have one. This file is part of Apache web servers, so if you don’t have Apache powering your server, you will have to do this a different way. Joost recommends using this script for NGINX servers, for example.
The file will sit in your root directory as well, along with your robots.txt and redirects.txt files. Chances are it’s already there; if not, create one. Just make a txt file and change the name to .htaccess without a file extension.
All the .htaccess code does is changes the display of the URLs when you create them. It changes the ?id= into nothing, so that your .com/out/?id=IDNAME turns into .com/out/IDNAME. It looks a lot better and hides the cloak that much more.
Now, this is a limited method of cloaking your affiliate links. You can use it as much as you like, but the more you use it, the more Google will want to check it out, and the more other bots will check it out. Google isn’t dumb; they know about this method, and they will know if you’re abusing it in a black hat way. Be warned that any cloaking with abuse behind it will cause problems.
If all of that seemed too complicated, there are some other ways to cloak your links. I can’t necessarily vouch for them being any less complex or any more secure, but here they are.
Regardless of the method you choose, cloaking your affiliate links can bring a boost to your sales because of the cleanliness of your links and the lighter view Google takes on the links. They don’t like a lot of affiliate links, after all, so they’ll frown upon having to many. Cloaking them alleviates this downward pressure and helps you get that much more traffic, ranking, and profit.
Growtraffic.com is the leading pop-under traffic network.
Get thousands of targeted visitors for wholesale prices.