Reply
Detecting affiliate links
Old 03-14-2008, 12:20 PM Detecting affiliate links
VirtuosiMedia's Avatar
Webmaster Talker

Posts: 604
Just wondering if anyone has any suggestions for detecting affiliate links with PHP. As an example, say that I'm creating a comments section for my website and I want to allow regular links in the comments, but not affiliate links. What would be the best way to go about that?

From an SEO perspective, it would probably be wise to 'no-follow' all user-submitted links anyways, but I would like to try to weed out the affiliates if I can as well.

I suspect that regular expressions could help, but I'm not familiar with all of the different affiliate link formats. Also, I would worry a little about false positives. I could probably also check the url against an array of common affiliate sites like clickbank, etc. However, using that method would require that a large list of affiliate sites be maintained.

I'll probably end up using a combination of the above, but I would love to get some more input if anyone else has ideas as well.
VirtuosiMedia is offline
Reply With Quote
View Public Profile Visit VirtuosiMedia's homepage!
 
When You Register, These Ads Go Away!
     
Old 03-14-2008, 12:58 PM Re: Detecting affiliate links
NullPointer's Avatar
Will Code for Food

Posts: 467
Name: Matt
Location: Irvine, CA
Most affiliate links I've seen just use url parameters. This might break user's abilities to post certain non-affliliate links, but you could just cut off everything after the ? in a url. By this I mean:
Code:
http://mydomain.com/index.php?affiliateRef=11111
//turns into
http://mydomain.com/index.php
All you would have to do is use explode to split the link.
PHP Code:
$link 'http://mydomain.com/index.php?affiliateRef=11111';
$linkArray explode('?'$link);
$newLink $linkArray[0]; 
Hope that helps
__________________
http://tinsology.com/ - Under construction
NullPointer is offline
Reply With Quote
View Public Profile
 
Old 03-14-2008, 01:12 PM Re: Detecting affiliate links
VirtuosiMedia's Avatar
Webmaster Talker

Posts: 604
Thanks, NullPointer. I did consider that, but there are so many non-affiliate sites that use url parameters that I didn't want to go down that route if I could help it.
VirtuosiMedia is offline
Reply With Quote
View Public Profile Visit VirtuosiMedia's homepage!
 
Old 03-14-2008, 04:21 PM Re: Detecting affiliate links
rogem002's Avatar
Webmaster Talker

Posts: 548
Name: Mike
Location: United Kingdom
I think NullPointer basically covered what you need to do. Personally I would use a preg_replace ( http://uk2.php.net/manual/en/function.preg-replace.php ) though, and possibly encode the URL's so that when they leave they go via a "Your now leaving my website" page.
__________________
Website Services
PHP Code:
if(Added_Talkupation($post) == TRUE){iHug($you);} 
rogem002 is offline
Reply With Quote
View Public Profile Visit rogem002's homepage!
 
Old 04-03-2008, 12:48 PM Re: Detecting affiliate links
Average Talker

Posts: 22
Name: Jeremy Smith
there are so many ways to cloak affiliate links though. it would be impossible to catch them. many people use url shortening services, some have scripts running on their websites so that the url looks normal. it's more trouble than it's worth.
thewebdude76 is offline
Reply With Quote
View Public Profile Visit thewebdude76's homepage!
 
Reply     « Reply to Detecting affiliate links
 

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.13732 seconds with 13 queries