How to Be Crafty and Mask Affiliate Links
April 18th, 2007 by Michael Gray in Grayhat SEO, conferenceIf you're new here, you may want to subscribe to my RSS feed. Read my top posts or learn more about Michael Gray. Want more frequent updates follow me on Twitter. Thanks for visiting!
Fine since Matt started this whole thing on hiding links and how people do it in really silly ways like putting nonsense in the onMouseOver WindowStatus I thought why not have a little fun and throw out a nice tip on how to mask your affiliate links.
Hypothetically speaking let’s say you’ve got a thin affiliate site, and you’re of the opinion having all affiliate links out is a “bad quality” indicator, or maybe you want to redirect your links for tracking, or maybe you even buy into the whole “no follow” advertising BS. Here’s one way to do it:
http://example.com/linkout.php?url=amazon.com
You write your script on linkout.php to scan for the URL parameter and redirect accordingly via Javascript. Now lets look at this link
http://example.com/linkout.php?url=amazon.com&p=12345
Now you update your script that so when it detects the “p” parameter instead of redirecting to amazon.com as a straight link it grabs the affiliate link in your database for ID 12345 and redirects accordingly. Regular people will think it’s a straight link and not an affiliate link. Now let’s get even more crafty
http://example.com/linkout.php?url=amazon.com&p=a12345
http://example.com/linkout.php?url=amazon.com&p=b12345
Lets make our script even smarter if the “P” parameter starts with an “A” we go and get the affiliate link from the database, if it starts with a “B” it’s just a dummy value and we use the URL value anyway. With the goal of being a responsible programmer I’d say you should use the “url” parameter as the default value and overwrite accordingly, but I digress. Want to get even more crafty how about this
http://example.com/linkout.php?url=amazon.com&p=c12345
When there is an “A” or “B” in the “P” parameter we redirect via Javascript and be sure to include the Noindex, NoFollow meta tags. However but when there is a “C” in the “P” parameter we redirect via a 301 instead of javascript. You could even be a little more clever and only do the 301 if you know it’s a search engine bot.
Lastly as a responsible programmer I should also warn you about not leaving yourself open to abuse. You should check for a referrer, and strip it down to the base domain, if it’s not you take whatever action you deem appropriate. Sure the examples given here might be pretty easy to spot, but they were also highly examplified. You could totally wonk things up adding random numbers or unix time values in for the dummy values, which would really make things harder to reverse engineer. You could also put the actual landing page URL instead of the simplified version I did here just to make things look that little bit more legit to pesky humans. There are few other things you can do, but I have to keep a few things dark and mysterious.
Sphere It










April 18th, 2007 at 5:54 am
I’ve seen something sneakier.
Link out to the real site in your static link (use nofollow if you want), then use a javascript onload function to replace the links on the fly with the affiliate ones (and even remove the nofollow, if you want to trick the nofollow-highlighers).
Without javascript it is just recommending the official site. With javascript it’s an affiliate site. Sure you might lose the 18 non-javascript users, but the others will use the affiliate links (check your logs for the numbers). Just make sure to test it across the standard browsers (check your logs).
If you want to be nice, you could even allow the user to turn affiliate links on / off :-).
April 18th, 2007 at 7:07 am
Great post! If one could expand this further I would suggest using a redirect server that will track traffic. Thus you can get the benefit of not passing PR, but you can get more data from each affiliate.
April 18th, 2007 at 11:06 am
Graywolf, you should have also mentioned blocking the linkout.php via robots.txt. That way if you are using affiliate link redirects you won’t get hammered as bad by the quality score bots if you are running PPC campagains.
April 18th, 2007 at 4:07 pm
Here’s a video tutorial on doing the same thing using PHP:
http://www.quityourdayjob.com/blog/2006/12/20/cloak-your-affiliate-links/
April 18th, 2007 at 5:00 pm
I like the referer idea…but am paranoid about cloaky traps that spoof browsers and referers..you think those Google guys would do such evil?
April 20th, 2007 at 4:25 am
Like “me” said, this fools the best of them:
href=”http://redirect/redirectcode” onmouseover=”this.href=’http://www.domain.com/’;” onclick=”this.href=’http://redirect/redirectcode’;” rel=”nofollow”
Right clicking on the link or mousehover shows “domain.com”, so webmasters who right click to look for the real url will be fooled into thinking they’re going straight to domain.com.
Clicking on the url replaces domain.com with refcode.
If javascript is disabled, then clicking on the link will just take you to the redirect url; that way you don’t lose clicks.
The only way visitors will realize they’re clicking on an affiliate link is to view source. Otherwise they’ll never know.
August 24th, 2007 at 7:33 pm
Wow a mouseover, that’s amazing.
August 25th, 2007 at 11:07 am
Gotta love cowards that hide behind anonymity.
October 30th, 2007 at 5:45 am
Great post.
“You write your script on linkout.php to scan for the URL parameter and redirect accordingly via Javascript.”
Why don’t you post an example of the php script to make it even easier for affiliates with no technical backround (like me):)