473,219 Members | 2,014 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,219 software developers and data experts.

where do they go? How can I gather Click info in PHP

Hi Folk

I was wondering if it is possible to find out what people click on, using
PHP.

For example, I have a PHP page with an email link and some third party links
(e.g. www.someone-else.com). I want to know where people go.

My own solution would be to make the link not to an email or a third-party
website, but to another page along the lines of

<?php
//check out where it came from and where it is going
//write info to database
header = {where it should be going}


?>

I am not sure if you can do this with email, but I am also wondering if
there is an easier/smarter way to do this.

Cheers

- Nicolaas
Jul 17 '05 #1
5 1837
windandwaves wrote:
I am not sure if you can do this with email, but I am also wondering
if there is an easier/smarter way to do this.


The header solution can only be used for normal links, not with email links
with the "mailto:" pseudo protocol.

But email links can, of course, link to an email form, so you can catch them
there.

Other solutions involve JavaScript, but you cannot rely on this because the
client can switch it off.
JW

Jul 17 '05 #2
Janwillem Borleffs wrote:
windandwaves wrote:
I am not sure if you can do this with email, but I am also wondering
if there is an easier/smarter way to do this.


The header solution can only be used for normal links, not with email
links with the "mailto:" pseudo protocol.

But email links can, of course, link to an email form, so you can
catch them there.

Other solutions involve JavaScript, but you cannot rely on this
because the client can switch it off.


Thank you for your answer, sounds like I may have to do something creative.

Cheers
- Nicolaas
Jul 17 '05 #3
Windandwaves

this is acutally rather easy.

the link that people click on should be something like:

<a href="/redirect.php?destinationURL=www.cnn.com">www.cnn.c om</a>
in redirect.php

you would code whatever is necessary to write the destination URL into the database and then redirect the visitor to the intended destination by doing:

header ('Location: '.$_REQUEST['destinationURL']);

that's all.

If you want to find out *where they come from* there is a variable called HTTP_REFER or something like that. Study the output of phpinfo(); to find the exact name.

There is a tutorial/article for exactly this called "where they went, where they came from" on
http://www.phpbuilder.com

Good luck!

GŁnther


windandwaves wrote:
Hi Folk

I was wondering if it is possible to find out what people click on, using
PHP.

For example, I have a PHP page with an email link and some third party links
(e.g. www.someone-else.com). I want to know where people go.

My own solution would be to make the link not to an email or a third-party
website, but to another page along the lines of

<?php
//check out where it came from and where it is going
//write info to database
header = {where it should be going}


?>

I am not sure if you can do this with email, but I am also wondering if
there is an easier/smarter way to do this.

Cheers

- Nicolaas

Jul 17 '05 #4
Guenther Schmidt wrote:
Windandwaves

this is acutally rather easy.

the link that people click on should be something like:

<a href="/redirect.php?destinationURL=www.cnn.com">www.cnn.c om</a>
in redirect.php

you would code whatever is necessary to write the destination URL
into the database and then redirect the visitor to the intended
destination by doing:
header ('Location: '.$_REQUEST['destinationURL']);

that's all.

If you want to find out *where they come from* there is a variable
called HTTP_REFER or something like that. Study the output of
phpinfo(); to find the exact name.
There is a tutorial/article for exactly this called "where they went,
where they came from" on http://www.phpbuilder.com

Good luck!

GŁnther


windandwaves wrote:
Hi Folk

I was wondering if it is possible to find out what people click on,
using PHP.

For example, I have a PHP page with an email link and some third
party links (e.g. www.someone-else.com). I want to know where
people go. My own solution would be to make the link not to an email or a
third-party website, but to another page along the lines of

<?php
//check out where it came from and where it is going
//write info to database
header = {where it should be going}



I am not sure if you can do this with email, but I am also wondering
if there is an easier/smarter way to do this.

Cheers

- Nicolaas

Thanks a lot GŁnther.
Jul 17 '05 #5
Guenther Schmidt wrote:
Windandwaves

this is acutally rather easy.

the link that people click on should be something like:

<a href="/redirect.php?destinationURL=www.cnn.com">www.cnn.c om</a>
in redirect.php

you would code whatever is necessary to write the destination URL
into the database and then redirect the visitor to the intended
destination by doing:
header ('Location: '.$_REQUEST['destinationURL']);

that's all.

If you want to find out *where they come from* there is a variable
called HTTP_REFER or something like that. Study the output of
phpinfo(); to find the exact name.
There is a tutorial/article for exactly this called "where they went,
where they came from" on http://www.phpbuilder.com

Good luck!

GŁnther

Here is what I did:

//link to database

$bot = browser_detection("type");
if(strlen($p) == 3){
$pageowner= $p;
}
if($h == 1) {
$httper = "http://".$pageownerwebsite;
}
elseif($h == 2) {
$httper = "http://".$pageownersecondsite;
}
else {
$httper = "http://www.myurl.co.nz/404.php";
}
$sqllog = 'INSERT INTO `LOG` ( `field1` , `field2` , `field3`, `field4` )
VALUES (NOW() , "'.$pageowner.'", "clicked","'.$httper.' ('.$bot.')" );';
$logger = mysql_query($sqllog);
$locationer = $httper;
header("Location: $locationer");

?>

It seems to be working well.
Jul 17 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: carrionk | last post by:
Hi, I'm currently working with a Legacy System whose only output is pivot tables in Excel. If I need certain data, I change the pivot table to get the information I want. All the info is...
0
by: **Developer** | last post by:
I know this is not the correct NG but I've been trying to get this answered for a while and can't find someone really knowledgeable about printers. (Actually it does relate to something I'm...
2
by: Joseph | last post by:
Has anyone had any experience gathering the local computername through a web application with no client side program. I've been researching different avenues and have been coming up blank so far. ...
2
by: MLH | last post by:
Say I'm walking a subset of the records in tblAddnlOwners via DAO. Suppose there are 5 records in the extract and that I MoveFirst, MoveNext and MoveNext. Then, when on the 3rd of 5 records, I...
10
by: Henry Jones | last post by:
I am using VB.NET 2005 and built and published my solution. When installing on a clients PC, where does the EXE go? Assume my project is Test. Shouldn't it be installed in C:\Program Files\Test ?...
5
by: Michael.Suarez | last post by:
Suppose I have a button on a form that opens up another form. the code in the buttons click event is: frmMyCustomForm frm = new frmMyCustomForm (); frm.ShowDialog(); frm.Dispose(); The...
3
by: rrstudio2 | last post by:
If I have two tables and need to do a left outer join and include a where statement on the second table, it seems like the left outer join becomes an inner join. For example: Table: Names id...
0
by: dhanu sahu | last post by:
I am entering Day,LoginId,Name,Checkin time,Check Out Time In TextBox and A SUBMIT button Twist Is : Once User Click Submit>>>> It can not be Editable Again Either refreshing or Using IE ...
2
by: Laurence | last post by:
Hi folks, My database DB03 is circular logging. I called the db2 procedure: get_dbsize_info to get the database size as below: Parameter Name : SNAPSHOTTIMESTAMP Parameter Value :...
0
by: veera ravala | last post by:
ServiceNow is a powerful cloud-based platform that offers a wide range of services to help organizations manage their workflows, operations, and IT services more efficiently. At its core, ServiceNow...
0
by: VivesProcSPL | last post by:
Obviously, one of the original purposes of SQL is to make data query processing easy. The language uses many English-like terms and syntax in an effort to make it easy to learn, particularly for...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
0
by: mar23 | last post by:
Here's the situation. I have a form called frmDiceInventory with subform called subfrmDice. The subform's control source is linked to a query called qryDiceInventory. I've been trying to pick up the...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
by: jimatqsi | last post by:
The boss wants the word "CONFIDENTIAL" overlaying certain reports. He wants it large, slanted across the page, on every page, very light gray, outlined letters, not block letters. I thought Word Art...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.