PHP Link Cloaking Surely is Powerful, If You Know What You are Doing
So I just read the guest post over at ShoeMoney.com on Link Cloaking. And while the guest poster took some crap for what many felt was just an affiliate link post, he had some good things to say. However, one comment in particular in his post was serious mis-information. His comment, “A PHP re-direct isn’t powerful, but it is effective and for a novice affiliate marketer I’d highly recommend it.” is dead wrong on the first part. A PHP redirect is far more powerful than any of the others he mentioned. Lets look at how.
First off, pulling up the predefined superglobal $_SERVER variable offers a few things:
- $_SERVER['HTTP_REFERER'] has where the cloaked link was clicked from. How valuable is that? Well, what if you had these links multiple pages of your site? Store this in a MySql table, and you’ve got some very interesting data to report on… like maybe which page on your site has the most click — might that page be more optimized to increase traffic? Maybe you could even set a subid based on this value so you can track which referer is sending clicks that convert better.
- $_SERVER['REMOTE_ADDR'] has the IP of the user (granted you need to do a little extra work to get the actual IP in the case of someone going through a proxy). Now you may now want to track user’s IP, but you might be interested to see if you are kind of getting DOS’d (same user clicking over and over — or maybe just clicking all your ads). This would be of use if you were trying to track anomalies.
After $_SERVER, you may want to take a look at using cookies. On a couple of my sites, I set a cookie based on the initial click in to my site (especially if the user came in via a PPC campaign). Well you might think that is stupid, but from that data I can track incoming clicks to outgoing clicks. Ahh you say! Now I can come very close to tracking the actual conversion rate on each click to my site. You will lose this data if a user does not allow cookies, but it is possible to implement the same type of thing via sessions that avoids data loss.
One other thing you might choose to do is to take the IP of the user, and if a particular offer is not available in their country, you could optionally redirect the user to a more appropriate offer.
Once you store all of this data in your database, you can then redirect the user through to their intended location with a standard header function call. In my mind then, a PHP redirect offers you ultimate power. You can start off using it for a simple redirect, and then over time you can add in any of the functionality above (all without changing the redirect link. Your imagination is the only limit of what you can do.


I’ve wrote a small article dedicated to easy cloaking methods using JavaScript and PHP for others that are not so good with programming
January 7th, 2008 at 11:46 pmhttp://richbeaver.com/webmasters/link-cloaking-step-by-step-guide/