473,799 Members | 2,929 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1868
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?de stinationURL=ww w.cnn.com">www. cnn.com</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?de stinationURL=ww w.cnn.com">www. cnn.com</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?de stinationURL=ww w.cnn.com">www. cnn.com</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_detecti on("type");
if(strlen($p) == 3){
$pageowner= $p;
}
if($h == 1) {
$httper = "http://".$pageownerweb site;
}
elseif($h == 2) {
$httper = "http://".$pageownersec ondsite;
}
else {
$httper = "http://www.myurl.co.nz/404.php";
}
$sqllog = 'INSERT INTO `LOG` ( `field1` , `field2` , `field3`, `field4` )
VALUES (NOW() , "'.$pageowner.' ", "clicked","'.$h ttper.' ('.$bot.')" );';
$logger = mysql_query($sq llog);
$locationer = $httper;
header("Locatio n: $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
3910
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 stored in the PivotCache as normally info would exceed 65535 lines, so theres no detail in DB format. I'd like to know if it's possible to connect Access to the pivotCache
0
1332
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 programming.) I'm not suggesting you do what I've outlined below - just read the steps I did. It has to do with printer parameters. Using Window XP printer parameters can be changed as follows:
2
1828
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. I'm working in a Intranet Env with Active Directory and all Windows XP clients. My end goal is to actually have an active desktop component that is branded for the company with other user and computer specific information that will help the IT...
2
1200
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 determine the need to append a record to tblAddnlOwners. So, I use AddNew and do it. Now, I'd like to keep on walking the records. I wanna go to the 4th then the 5th and be done with it all. As I'm walking, I might have to append
10
1643
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 ? It isn't and I don't know where to look. ON the Start menu, the Project shows up with a shortcut and I can run the program, but I don't know where it is stored. Thanks, Henry
5
4696
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 form opens, user does what they need, the form closes, and gets
3
2693
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 Name StatusCode 1 John 11 2 Henry 22 3 Bob 33
0
755
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 Back Button… Next is.... In above I can enter PER DAY INformantion but I need For 1 week Info.. Like This... This is my last module So plz help me..... I need to b submit project next week.. in GridView Iget This Informantion..........
2
2261
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 : 2008-04-08-06.39.49.518070 Parameter Name : DATABASESIZE Parameter Value : 24666112
0
10473
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10219
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10025
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9068
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5461
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5584
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4138
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3755
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2937
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.