Google Answers Logo
View Question
 
Q: Using PHP for referral tracking ( No Answer,   3 Comments )
Question  
Subject: Using PHP for referral tracking
Category: Computers > Programming
Asked by: offplay-ga
List Price: $2.00
Posted: 05 Apr 2004 11:08 PDT
Expires: 05 May 2004 11:08 PDT
Question ID: 325509
Dear Sir

I wish to have a script which can log 
a, Date , time , ip address , referral URL to my site

as simple as that. 
I have then came accross this site: 
http://www.phpfreaks.com/tutorials/22/1.php

Follow the instruction there, but it just didnt work. 
I think probably the main reason is i didnt enable the web server to
write on the file.

Please advice me how can i make this work
thanks!

p/s:
I have no knowledge about php
the page i create:
http://www.connecttomypc.com/testlog/service.htm
http://www.connecttomypc.com/testlog/logs.txt

Thank you

Clarification of Question by offplay-ga on 05 Apr 2004 23:33 PDT
you guys reminded me!
How stupid :p
Change it to php
it's working now. 
The outcome is below:

6/Apr/2004 @ 01:24:58 [-0200 for PDT] IP: 82.39.51.179 "GET
/logtest/webaccess.php HTTP/1.1" 200 1718 "" "Mozilla/4.0 (compatible;
MSIE 6.0; Windows NT 5.1) Opera 7.22  [en]"


But there is still one thing left, that's the referral url 
I need to know where my visitor come from.
What's the code for this?
$uri = $_SERVER['REQUEST_URI']; ?????
What I have done was 
1.htm as my main index, then call up 2.php, and write to 3.log (example)
thank you..

Clarification of Question by offplay-ga on 05 Apr 2004 23:38 PDT
Oppssss.....
seem I have the referral link appear in my latest log. 
I have advertise in google adwords
My Adwords point to "http://www.connecttomypc.com/?source=adwords"
My log has appear the same link " http://www.connecttomypc.com/?source=adwords "

If i am not wrong, normally my log should appear as
"://www.google.com/search?q=connect&sourceid=opera&num=0&ie=utf-8&oe=utf-8
"

How can i fix this...
Answer  
There is no answer at this time.

Comments  
Subject: Re: Using PHP for referral tracking
From: googleexpert-ga on 05 Apr 2004 11:50 PDT
 
Hi offplay,
You should rename the file service.htm to service.php
Currently the PHP Source code for service.htm is visible when you "View Source".
Subject: Re: Using PHP for referral tracking
From: teddycaddydotcom-ga on 05 Apr 2004 23:21 PDT
 
You gotta make the files end in .php extensions instead of .txt or .htm

If you go to those pages and view the source code, you can see the PHP code.

The PHP code should not be displayed.  It means it is not being read
by your webserver.
Subject: Re: Using PHP for referral tracking
From: okrogius-ga on 18 Apr 2004 17:57 PDT
 
Referrer value is passed in under $_SERVER['HTTP_REFERER'] (spelled
that way on purpose). Do note that it's up to the browser to send
that, and there is nothing to prevent a client from altering the value
sent - so while it may be useful for statistics you should never rely
on it for anything important.

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy