Code to Manually Cloak Affiliate Link Redirects

An easy method of manually cloaking an Affiliate link to redirect to any affiliate program you choose to promote… is by writing one simple line of php code. To enhance the security of such links, be sure to give the file a .php extension [as opposed to .html] - it does not matter if the rest of your web’s pages are .html
This form of masking hides your affiliate link from showing in the address bar, but does require your own website or at least access to a limited web space for uploading the simple text file… that must be created for each new affiliate link.
How To write PHP Code for Cloaked Affiliate Link Redirects:
1. First create a folder {not a file] on your desktop and give it a name relative to the Affiliate product. So to promote Mike Filsaime’s… Butterfly Marketing manuscript… you might name it “Manuscript”.
2. Copy n paste the following into Notepad or any simple text editor, and replace the “xxxxxx” with your clickbank username. Note that “bfmscript” is the product name Clickbank has assigned to Butterfly Marketing:
<?php
header(”Location: http://xxxxxx.bfmscript.hop.clickbank.net”);
?>
3. Name the above text file as “index.php” and save it to the “Manuscript” folder you created on your desktop. It is important the file is called “index.php” and nothing else.
4. Upload the entire “Manuscript” folder via FTP into your domain’s “public_html” folder.
5. Then advertise your new cloaked link as “http://yourdomain.com/manuscript” which looks a lot more professional than a Clickbank, or other long, affiliate link… effectively, stopping affiliate link thieves from substituting their affiliate id and hijacking your commissions
6. Test the link by typing http://yourdomain.com/manuscript into a browser. It should redirect straight to the merchant’s program, all the time protecting your id by not displaying the affiliate url at any time in the browser.
7. A similar method of cloaking can also be used to format a Clickbank link… this time to completely bypass a “weak” merchant’s sales page, and go directly to the Clickbank order page. Refer to an earlier post on Correct Clickbank Affiliate Code to bypass Merchant’s sales page - Go Direct to Clickbank order form for the exact link format to use.
NOTE: Apart from Clickbank, this method of affiliate link cloaking works with any other affiliate program. Simply replace “Clickbank” url in the provided example with any other affiliate url … For example affiliate links from: Commission Junction or PayDotCom or those provided directly by the owner of a product.
As my online marketing expanded to include a larger amount of blogs and affiliate campaigns it was timely to further automate my business… necessitating an investment in a professional affiliate link cloaking/masking/redirect program that would also provide some quick statistics on the number of clicks for each link.
Affiliate link masking software can cost between $47 - $97. Most of them will allow you to paste in an affiliate link which is cloaked on pressing the submit button. But the cheaper products still demand that you manually upload the HTML for the cloaked link to a website.
The better products however do not require this tiresome manual step… I initially settled on Power Link Generator that went offered these critical features to further protect my affiliate income.
- The entire cloaking of the link takes place within the software itself, that is installed on just one domain - so no more having to cut n paste blocks of HTML or PHP code into separate web pages for each product. NOTE: It’s great in that it needs to be installed ONLY on the one domain but will cloak links on ALL my other blogs and domains as well.
- I can opt to completely stop my affiliate link from showing in the address bar and/or choose to have the masked link only, appear on the merchant’s website.. which adds credibility with the illusion of the product being hosted on my website
- As outlined above, but this time by simply ticking the appropriate box, I can choose to automatically bypass a weak product sales page - sending the visitor directly to the Clickbank or other product order form … and best of all….
- When a visitor clicks on my masked affiliate link, and afterward decides to either put off the purchase for a few days… or type the merchant’s link directly into a browser, my PLG program has already “silently” cookied them and I still receive credit for the sale
This software has been further upgraded since its inception, with PLG evolving into a user-friendly and uncomplicated affiliate link masking program. Particularly recommend the investment in an uncomplicated tool like PLG for new affiliate/web marketers.
IMPORTANT Update: After a long 3 years online.. my earnings surpassed $9,700 monthly - smile! [Not huge figures comparatively - but getting a profitable system into place only came through trial and error. When blogs became popular 5 years ago and I started my online marketing - we didn't have the benefit of the freely available knowledge and plethora of video tutorials available in 2008.]
As a result… to successfully track affiliate actions on other websites, and get accurate ROI [return on investment] figures for Google Adwords, Pay Per Click, and Sponsor Advertising on my sites… an investment in an all-in-one Ad Tracking /Affiliate Link Cloaking Program that offered all of the following analytic tools was essential:
- Ad Tracking
- Split Testing - two different versions of a variable [which headline, color, graphic, body text etc. gives higher click through rate]
- How many people come to a website from each traffic source
- Tracks sales, subscriptions, downloads, etc. from each of traffic source - tracking conversions too
- Tracks sales and actions on remote, affiliate websites
- Use Sub-Campaigns to fine tune tracking, down to the tiniest detail
- Calculates cost per click, cost per sale, and cost per action for each traffic source to determine ROI
- Tracks which keyword generates the sale in google adwords, overture, or any major ppc engine
- Analyzes and logs click to sale and click to action conversion ratios
- Calculates ROI, to quickly see which traffic sources are making money, and which are not!
The Pro Tracker software also offers the full Affiliate link masking, cloaking and redirection protection - plus all of the features of the simpler Affiliate Links program [Power Link Generator] that I used as a starting point to track links on this blog:
- Protect affiliate sales from commission theft with encrypted redirect pages! [Works with ANY affiliate program, especially Clickbank]
- Automatically shortens tracking Urls and make them look like just another page on a website
- Gives an Unique “Bird’s Eye View” of all your traffic sources in Real Time without loading several pages from different sites
- Customizes and saves your favorite statistics report so you can login and press one button to check all your statistics!
I think you get the idea. I don’t often recommend affiliate software within Blog posts, but firmly believe that any online business operating without a full tracking and link protection system is flying blind… and yes, that includes blogs as well.
There are many other tools available to track Affiliate links and ROI and some of them are free - but as the choices can be somewhat daunting particularly for a new entrepreneur, I hope sharing what has worked for me helps somewhat in your dilemma.
Have you used a similar program with success… please share your experience - good or bad, via the comments below.
If you like my content, please consider subscribing to the:






































[...] the post Code to Manually Code Affiliate Links for an example of simple, manually inserted code to mask affiliate [...]