cancel
Showing results for 
Search instead for 
Did you mean: 

Monitor visitors to my site

cnugent
Newbie
Posts: 1
Registered: ‎06-05-2012

Monitor visitors to my site

I recently wrote a letter with almost 30 people on the cc-list.  The text made reference to over 20 documents, so I decided to post these in a dedicated folder on my site as *.pdf files.  Since there were some issues of confidentiality, I password-protected the folder using Plusnet's excellent system available at: http://community.plus.net/library/tools/how-to-password-protect-your-website/.
It would be nice to be able to monitor who has visited this folder and which pages they accessed.  If someone made their unique ID available to people outside the cc-list, that too would be useful to know and I would expect it to be reflected in their apparent pattern of visits.  People need to sign in with a user name and password, so that should be relatively easy to capture.  Their login details could then be associated with their online ID, to track which pages they had visited within the folder. 
I asked the Plusnet technical support team whether this is available as part of their service and was referred to this forum.  I assume that this would be achievable using php and MySql but am not sure how the act of logging in to the folder could trigger the code and capture the User Name.  How then could further "OnClick" events be captured, as they navigated around the site?
If anyone has been here before and found a solution to this or a similar problem, within the limitations of the Plusnet framework, I would be grateful for their advice.  I imagine that this would be a useful facility to cover a variety of situations but I have so far failed to find it referenced in any (recent) posts.
Chris
3 REPLIES 3
x47c
Grafter
Posts: 881
Thanks: 3
Registered: ‎14-08-2009

Re: Monitor visitors to my site


I can't help you the specific nature of how to do it......which sounds more like an online banking grade of website:  but be aware that you are sliding down the slippery slope into the morass of  "data protection" and "privacy issues" if you are going to start associating and recording individual page use with identifiable individuals.
whelpton
Grafter
Posts: 104
Registered: ‎06-06-2011

Re: Monitor visitors to my site

See Below
whelpton
Grafter
Posts: 104
Registered: ‎06-06-2011

Re: Monitor visitors to my site


To a pdf document; not as far as I'm aware. The php script that I made to track things on my sites is:
<?php 
$ip = $_SERVER['REMOTE_ADDR'];
$date = date("j/m/Y, g:i a");
$user =  $_SERVER['PHP_AUTH_USER'];
mysql_query("INSERT INTO track(date, action, user, ip) VALUES ('$date','Accessed File','$username','$ip')") or die(mysql_error());
header("Location: file.pdf");
?>

As you can see at the bottom of the script is a redirect that will take you to wherever you want to be which in this case is file.pdf or whatever your pdf would be.
The sql you would need to keep this information is:
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
CREATE TABLE IF NOT EXISTS `track` (
 `id` int(11) NOT NULL AUTO_INCREMENT,
 `date` varchar(100) NOT NULL,
 `action` varchar(1000) NOT NULL,
`user` varchar(50) NOT NULL,
  `ip` varchar(50) NOT NULL,
 PRIMARY KEY (`id`),
 UNIQUE KEY `id` (`id`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=100 ;

Of course for this to work, PHP & MYSQL DB are required, I have modified my session based username capture to use:  $_SERVER['PHP_AUTH_USER']; , which theoretically should work but is not tested personally.