Forum Moderators: coopster

Message Too Old, No Replies

Problem with Environment variable?

Please help me with this little script.

         

onlineleben

12:40 pm on Jan 14, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hello
I am facing a little problem (at least it is a problem for me) that any decent PHP coder can solve:

I want to track referrals coming from Google Adwords. thereore I have a small script installed that retrieved information about date/time, remote IP address, and referer (full referer with all search information).
Until now it was easy for me.
All my Adwords Ads have target URLs like mydomain.com/mypage.htm?G45
What I want to do is readout the part behind the questionmark.
How is this possible?

The script I have in place so far looks like this:

$timestamp=date("Y/m/j H:i:s");
$addr=getenv("REMOTE_ADDR");

$ref=getenv("HTTP_REFERER");
$myfile="/path/to/cgi-bin/testlog.txt";

$fd=fopen($myfile,"a");

$success=fwrite($fd, $timestamp."¦".$addr."¦".$ref ."\n");
fclose($fd);

Any help on this is very much appreciated.Thanks in avance.

johannes

2:22 pm on Jan 14, 2004 (gmt 0)

10+ Year Member



Which file is the script called from? mydomain.com/mypage.htm?G45?

onlineleben

2:30 pm on Jan 14, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Thanks for the reply.
In the meantime, i have figured things out myself. The variable needed is Query_String and things work OK now.

To answer your question: this little script is called from the page that gets the click from google. So what I do is track which ad is how often clicked and which keywords are used. quite helpful when you don't get too many clicks.