Current location: Hot Scripts Forums » Programming Languages » PHP » how do i determine where a visitor has come from?


how do i determine where a visitor has come from?

Reply
  #1 (permalink)  
Old 07-20-05, 11:32 AM
buzzby buzzby is offline
Newbie Coder
 
Join Date: Apr 2004
Posts: 32
Thanks: 0
Thanked 0 Times in 0 Posts
how do i determine where a visitor has come from?

i need to know where a user has come from, how the user got to my site. i will be submitting my site to certain agencies and i need to know from where these users have come from. they will no doubt be from these agencies. i need to know this so when i get work via these sites i know who to pay the 10% commission to. how can i achieve this
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 07-20-05, 12:39 PM
Keith's Avatar
Keith Keith is offline
Community Liaison
 
Join Date: Feb 2004
Posts: 1,232
Thanks: 1
Thanked 11 Times in 11 Posts
Some useful info to record:

IP Address
Code:
$_SERVER['REMOTE_ADDR'];
Referring Website/webpage
Code:
$_SERVER['HTTP_REFERER'];
Timestamp - can be converted to any date format with date();
Code:
time();
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #3 (permalink)  
Old 07-21-05, 03:23 AM
dennispopel dennispopel is offline
Coding Addict
 
Join Date: Mar 2005
Posts: 263
Thanks: 0
Thanked 0 Times in 0 Posts
Hello,

Basicly this works as follows:
1. You analyze the referrer ($SERVER['HTTP_REFERER']) which holds the URL of the site that referred your visitor (but beware that this variable may be optional - it is not mandatory by the HTTP specs, and browsers may hav it turned off)
2. Based on that you set up a cookie that gets sent to the browser with lifetime of, say, one week (so that you are honest with your afiiliates - the visitor may wish to think for some time after he has visited your site). Using cookie will assure that if he returns in a couple of days, he will still be identified as being referred by the affiliate.
3. At the moment of purchase you examine if the cookie is present and update your affiliate's account.

The problem is that user may have cookies also disabled, so while this method will work for 99%, there still may be failures present.
__________________
onPHP5.com - PHP5: Articles, News, Tutorials, Interviews, Software and more
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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

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

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
help me determine whats wrong Cmrdrv The Lounge 6 08-12-03 12:57 PM


All times are GMT -5. The time now is 09:19 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.