Tracking Affiliate Clicks

Posts: 10
Joined: 08/13/2007
Uber Donor

I created a mashup of the affiliate module on drupal.org and some of the techniques provided by VitaLife. The way I'm tracking affiliate referrals is by the URL. I've setup a wildcard DNS entry (*.mydomain.com) so that users can use their username as their affiliate URL. (e.g. user_name.mydomain.com). The module verifies that the user is actually a valid referral, by role, and redirects to the default URL if they are not. If they are, a click is recorded in the database. BTW, this required that I use a wildcard SSL cert as well so that all secure pages worked using affiliate URLs. The way this is being handled could probably be a configuration setting so that if you can't use wildcard domain name, the url could be something like mydomain.com?a=affiliate_id as in the original affiliate module.

The other thing I added to my module was the ability to change the depth of affiliate tracking. VitaLife's solution was built for 2 levels. The way I've set it up, you could have only one level, or 10, and you can configure the percentage discount for each level.

Although I do have it working, it is still a work in progress and there is some cleanup still to be done. One big thing that still needs to be done is a way configure which products are "commissionable" and which are not. My temporary solution was to create separate product classes and do a check in the code. This needs more thought though. Still, I'm attaching it for anyone that's interested.

AttachmentSize
uc_affiliate.zip16.51 KB
How are people doing Affilate Stuff with Ubercart By: VitaLife (24 replies) Tue, 10/30/2007 - 15:09