Jump to content

[SOLVED] How do I find out who refered a visitor to my site?


ahvceo

Recommended Posts

Hi All,

 

I am 72 and I am just learning php.  I have a general question about referals.  If I refer some one to a site using my affiliate link how do they know it was me that refered the person to that site?  I know my link is coded with a code identifing me but how do they get that code?

 

I would really appreaciate some help with this as it bothers that I might not get paid for refering someone.  I might also want to have someone refer people to my site and I would like to pay them for it.  Can anyone explain to me how this all works?

 

Thanks

ahvceo

Link to comment
Share on other sites

Variables like a referrer are always stored in URI variables (information included in the URL that brings you to a specific site/page).

 

For example, you might see a link like... http://site.com/signup.php?referrer=ahvceo

 

You can access this referrer variable using the predefined $_GET array:

 

$referrer = $_GET['referrer']; //$referrer now stores your name!

 

Hope this helps!

Link to comment
Share on other sites

You must generate a UNIQUE code for each user, and use this code to identifiy which user the code belongs to in the data base. There are plenty of ways of doing this, for ex. you can use user's ID in the database, encrypt the id if you like for security reasons.

 

using URI, like the above user said, use the $_GET to retreive the HTTP VAR called "ref" or w.e you like.

 

ref can be "index.php?ref=230983324"

 

so the ref is the USER's ID

Link to comment
Share on other sites

Hi All,

 

Thank much for the quick replies, I really appreciate it.

 

Does the "$referrer = $_GET['referrer'];" statement get any referral id or does it just get the ones that are identified by a particular code. For instance if my referral code is "http://amazinghomeventures.com?ref=ahvceo", would the above statement work or would I use "$referrer = $_GET['ref'];"?

 

Does the statement return "referrer=username or just the username?

 

Does it work if there is an interveining URL?  For instance if someone is referred to my site and I send them to PayPal before I try to get the referrers name, can I still get it this way?

 

Thanks again, looking forward to your next reply!

ahvceo

 

Link to comment
Share on other sites

Hi All,

 

Thank much for the quick replies, I really appreciate it.

 

Does the "$referrer = $_GET['referrer'];" statement get any referral id or does it just get the ones that are identified by a particular code. For instance if my referral code is "http://amazinghomeventures.com?ref=ahvceo", would the above statement work or would I use "$referrer = $_GET['ref'];"?

 

You would use $referrer = $_GET['ref']; What lies in the $_GET quotes is the name of the variable in the URL.

 

Does the statement return "referrer=username or just the username?

 

Does it work if there is an interveining URL?  For instance if someone is referred to my site and I send them to PayPal before I try to get the referrers name, can I still get it this way?

 

Thanks again, looking forward to your next reply!

ahvceo

 

 

Yes, you can still get it.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.