Bonk clickTrackr is a simple javascript that can track and log a visitors clicks on your site and generate heatmaps over the tracked pages. It can be configured to track all clicks or just the last click the visitors does before leaving the page.


All arguments are optional and you can also change the default values to fit your common setup.

bCT.init({ all, freq, refId, log, url, maxX, maxY });

all Track all clicks on the page or just the one that the user clicks to unload it.

freq Only initiate the tracking for every N'th time. Around 2-3.000 clicks are ideal for generating a heatmap for a page, so try to set your frequency accordingly.

refId Element id where reference point (0, 0) should be. If no refId is set, the browser windows own coordinates will be used.

log URL for the log script or where the 1x1-gif-image is located.

url The current page where the script is running.

maxX Upper limit for X-values to track.

maxY Upper limit for Y-values to track.

See the source file for more information and how you can change the default values.

log.php - clickTrackr Realtime Logger

This PHP-script receives the data and applies some filters and features to store the coordinates you want.
If you want to track a large number of clicks and don't have the database performance for it, we recommend that you use a static GIF-image and parse the access-logs off site.
Example: bCT.init({log:'http://your-cdn/bCT/log.gif'})

$addUnknownHosts When enabled, new unregistered hosts will be added and tracked. Will ignore data from unknown hosts when disabled.

$blockedHosts Possibility to ignore request from given hostnames.

$knownHosts List of known hosts (overrides $addUnknownHosts and $blockedHosts). If you have a fixed amount of hosts and don't need to add new ones automatically, it's a perfomance boost to have them specified here. No memcache- or db-lookup has to be made to match host to hostId.
Note! If knownHosts is specified and doesn't match anything, the script will not track anything.

$useSyslog If syslog is enabled, nothing will be stored in memcache or database but will be written to the servers logs instead. This could be useful if no memcache or MySQL is available.
Log rows have the following format:
clickTrackr - {"host", "path", x, y, timestamp} (data is json-encoded).

$memcacheServers Memcache servers used to store hosts and paths ("null" disables memcache features). Requires libmemcached to be installed on the server. Memcached server.

$mysql MySQL settings

You are free to modify the log-script to fit your needs and remove parts you don't use.


Latest version can be found here