Active
Project:
User Referral
Version:
6.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
26 Nov 2008 at 20:38 UTC
Updated:
27 Nov 2008 at 16:56 UTC
A site I'm building has a requirement to track the sign-ups that occur from various landing pages. Using referral.module, I can facilitate this by ensuring that there is a different user that is associated with each of the landing pages. It's a little hacky, but it works.
However, what do you think about allowing drupal admins to spin-up "userless" referral links? The links could probably contain keys that the user defines, rather than the hex code that currently gets created for user referrals.
Your module names itself "User Referral", but it's really just called "referral", so it might fit in nicely :-).
WDYT?
Comments
Comment #1
kbahey commentedWe do keep currently the information about URLs in the database (http_referrer), so we could use that I suppose.
We could add code to check in referral_get() to check if _referral_ref2uid() returns false, and then record in the cookie that the referring user is 0 (no body), and voila, you get what you want. No need for userless referral links as you call them.
Perhaps we should make that an option in the settings, so users are not confused by it being on by default.
Comment #2
ryan_courtnage commentedI like where you are going with this. The current problem I see is that http_referrer does not exist if a user hits the referral url directly, as they might if the link was emailed or otherwise given to them.
Perhaps it's worthwhile storing REQUEST_URI, or even just the referral code that was used [arg(1)]?
Comment #3
kbahey commentedIn the event we do not have a referral link, nor an http referrer, we record nothing, simply because there is nothing to record.
Meaning, if we have no valid referral link, nor a valid http referer, then we should not record a referral event.
We are no worse off than we are today.
Comment #4
kbahey commentedComment #5
ryan_courtnage commentedRight, but suppose we went ahead and changed _referral_ref2uid() to set the referring uid to 0 when no valid referral id is found. A site owner then distributes 2 links that I want to track signups from:
referral/canadians-rule
referral/americans-rule
Any referrals generated would be stored as being from referral_uid 0. However, there is no context around the referrals - no way to know if canadians or americans rule more...
Another problem might be that some script kiddies might start hitting referral/aussies-rule, which I do not want to track referrals for. So there would probably need to be some place where the admin has defined what the valid "userless" referral links are.
hmmm
Comment #6
kbahey commentedMy "solution" depends on NOT modifying ref2uid, and letting it return FALSE if the referral URL cannot be decoded as a valid hex code that has an underlying UID in it.
In this case, we just use the http referer.
The module's design depends on calculated hex code. Introducing something else needs a redesign.
If the above outline is not enough to satisfy the requirements for your case, then it needs to rethought.
Comment #7
ryan_courtnage commentedYa, I'm not so sure that using the http_referrer would work for my case. In my case the admin would probably have to pre-define URLs to track signups from. Since it would need it's own table, an addition like this might be best to implement as a new module that depends on referral.module, and hooks into it's tracking magic at various places.
Comment #8
kbahey commentedIf we can make referral more of an api with other modules hooking on to it, that would be a big advantage, since it would open the api for many other things.
The current "user" referral would be one implementation, tracking users via a hex code.
Tracking pages would be another.
...etc.