0

I have built a simple webpage for a touchscreen kiosk (Win7, XAMPP).

The interface is built up of 9 tiles (windows metro style). HTML, PHP and CSS only. Each of the tiles are simple <a href="http://www.example.com">links</a>

What I would like to do is track how many times each of the tiles have been clicked.

Examples of my pages are;

  • www.example.com/help.html
  • www.example.com/contact.html
  • www.example.com/map/floor1.html

The kiosk will be running on localhost and I feel that Google Analytics, Piwik or AWStats are too resource intensive for such a small task. Obviously as the kiosk is running on localhost the IPs, location, browser etc... aren't important.

Are there any other ways I could track the clicks to a log file or similar?

Any advice appreciated.

jonboy
  • 2,729
  • 6
  • 37
  • 77

2 Answers2

0

You can use onclick functions on the links, and use javascript to write a log file. This might help you creating a log file through javascript

Community
  • 1
  • 1
Alekos Dordas
  • 802
  • 7
  • 20
0

I would say this data can be found inside Apaches access logs if you only want to know how many times a page has been accessed. This can be easliy done by using a tool such as Apache Log Viewer.

If you actually want to log link clicks, you probably have to use javascript action handlers. Because I consider writing from JavaScript ugly, I would probably send an ajax request to my PHP server every time.

Edit:

Another way would be, to convert all you html files into php and log from there (I can also add an example how).

Example:

<html>
<?php
$count= include 'count.php';

$count['count-'. __FILE__]= $count['count-'.__FILE__] + 1;
file_put_contents('count.php', '<?php return ' . var_export($count, true) .'; ?>');
?>
</html>
Luka
  • 435
  • 1
  • 7
  • 18
  • Thanks @Luka the Apache log viewer looks good, although I'd prefer if it were free. I like the idea of converting the html to php. I only have one html file with 9 links so it should be easy, right? – jonboy Oct 06 '15 at 14:27
  • Converting to php is actually just changing the file extension. But you might have misunderstood me. The php must go into the site that links lead to (assuming they are yours). Then you have to add some sort of a logger code in in. Apache Log Viewers basic functions are actually free though, but I never tried the new versions. – Luka Oct 06 '15 at 15:42
  • Thanks. If you could like you said add a quick example of the php logging code that would be great! I do understand php (novice). I'll accept the answer then I think :) – jonboy Oct 06 '15 at 16:12