Affiliate Link Masking, Redirecting and Tracking

We encourage users to post events happening in the community to the community events group on https://www.drupal.org.
parasox's picture

I'm pretty shocked there isn't an easy and trusted solution for this, but I've yet to come across it if it's out there. Wordpress and Joomla both have Drupal badly beat for this functionality I'm afraid.

Basically many affiliates want to link to sites without their users seeing the links, or knowing exactly where they're going to end up. It also helps with SEO.

We need a Drupal module that will add masking, redirecting and tracking of outbound links. Ideally it should work with the Link module (http://drupal.org/project/link) as that's what most people use to save URL's. Says nearly 70,000 sites use that module.

More information in this thread: http://drupal.org/node/821408

Comments

So it sounds like you're

Garrett Albright's picture

So it sounds like you're basically wanting to:

  • Create a special URL on your site.
  • When that URL is accessed, add 1 to a counter for that corresponding URL, and then…
  • Redirect the visitor to a corresponding off-site URL.

Is this correct?

Yeah, I don't know of a module which currently does this, but it sounds like it should be fairly easy to implement. And assuming I'm understanding what you're asking for, I don't think the Link module would be relevant for it.

Yes. Most affiliate sites use

parasox's picture

Yes. Most affiliate sites use something like a "direct.php" with a ?link_id= or similar appendage that serves as their redirect, and they can add a +1 to a database for click tracking if they choose to in the logic of the php file.

In Drupal it seems people lean towards creating an alias for each URL which I guess serves the same purpose.

I have tried GoTwo, but I think it was a little bit over my head or I just didn't try hard enough to get it working. You need to put a sort of code into each GoTwo field on node creation, and I don't think I ever got the code right so it didn't work.

I try to think of perfect scenarios mostly based on how a user creates a node, because if you create 5,000 nodes over time, the least amount of work required at node creation time yields the most benefits.

In my mind, that's using the Link module, because it's where you're saving the target URL in the first place. If you could just choose "Mask" and "Count Clicks" as defaults on a Link field, then the amount of work on data-entry is the same. Just type in the URL and the defaults you chose will take effect, and would require no extra work. Also, if programmed correctly, these links could ensure SEO best practices as far as 301/302 response codes, rel="nofollow", etc.

I do think this is VERY important functionality for Drupal as a whole moving forward, to attract more people to our community. Wordpress and Joomla both have this functionality, and are the main choices for affiliate type webmasters.

The modular approach is great in Drupal, but I think GoTwo is perhaps too much for this basic functionality.

To setup GoTwo, I installed the module, added a field to my content type, and set the default field values to:

<go href="[link]" title="[title]">[title]</go>

Which produces nothing, just a blank. Seems simple enough, not sure why that wouldn't work. If anyone can help with that syntax, please let me know.

Similarly with the Link module, there's a Link Image module, because Link doesn't let you link an image to a URL natively.. The Link Image addon module is all great, except that A> it requires me to save my link twice when I create nodes B> it doesn't support tokens, so you need to manually write in the image title and alt text, whereas the Link module DOES support tokens.. Link Image breaks that support.

I think this kind of stuff needs to be thought about as it relates to Drupal, to get more noobs like me involved. :) I'm sure a lot of programmer types just save their links to a text field and manipulate them in PHP, however the beauty of Drupal for me is how I can build large, complex websites with barely needing to write a single line of code.

Thanks for the input people! Wish I'd come back to this sooner, but it doesn't show up in my Dashboard because it's from groups. I guess.

Filter enabled?

torotil's picture

The syntax looks just fine.

 <go href="[link]" title="[title]">[title]</go>

It might be a wild guess. But did you enable the input filter?

The 'go' entries can be automatically created by enabling the filter. …
-- http://drupal.org/project/gotwo

gotwo module

greggles's picture

http://drupal.org/project/gotwo

Maybe that will be something you can use?

yep, gotwo seems to fit criteria

alexdim's picture

I came here looking for exactly what the OP is looking for. I installed the gotwo module last weekend and seems to fit the bill. It cloaks links, redirects and tracks clicks. I don't have the links module installed so I can't vouch for the compatibility with that. Thanks for the suggestion greggles.

Thanks for the input Alexdim,

parasox's picture

Thanks for the input Alexdim, as per my response above, do you mind sharing what your actual GoTwo Link syntax looks like?

I am sorry, I have not been

alexdim's picture

I am sorry, I have not been to the board here since I left that comment. If you are still interested here is my syntax:

<?php
<go href="http://www.affiliateurl.com/" title="url-you-want-to-show.com">anchor text</go>
?>

when the visitor hovers over the anchor text they will see this:

http://www.yoursite.com/go/url-you-want-to-show.com

Replay: I am sorry, I have not been

hariharasuthan_mk's picture

In drupal , there is standard to set anchor tag

say for example

 
<?php
l
(
 
t('anchor text'),
 
'http://www.affiliateurl.com/',
  array(
   
'attributes' => array(
     
'class' => 'widelink',
     
'title' => 'url-you-want-to-show.com',
    )
  )
);
?>

for more refernce drupal 6 => http://api.drupal.org/api/drupal/includes--common.inc/function/l/6

anonymous07's picture

Sorry, I am not trying to hijack the thread, I am just wondering if GoTwo or any other Drupal module may be able to cloak links that are brought into a node via php include ... on the fly, without any manual intervention or typing?

If I should start a new thread to get this answer, please let me know and I will. Thanks

Hi, I am trying to get this

Summit's picture

Hi,

I am trying to get this working using link, shorturl and custom formatters. Anyone has such a solution also?
greetings, Martijn

anyone got this working?

BeaPower's picture

anyone got this working?

Looking for answers

beauvafr's picture

Looking for answers too!

Anyone have comes with a solution ?