Help » Features & reports » Events »

How to log events

Tracking events requires minor Javascript programming abiltiies on your end.

The most typical use case here is tracking interactions with Javascript menus.

Your menus are probably built with standard HTML, and then after the page loads, a Javascript function is called that parses the HTML and makes dynamic things happen when those links are clicked. All you need to is add calls to clicky.log() within this "menu function" to log them to Clicky.

A simple example, assuming you have jQuery installed on your web site:


<div id=menu>
<a href=# data-menu="about">About</a>
<a href=# data-menu="help">Help</a>
</div>

<script>
$(function() {
$('#menu a').click( function() {
var menu = $(this).data('menu');
// do stuff as normal with 'menu' variable, then...
clicky.log('#menu', menu);
});
});
</script>


You can view reports for events in Content -> Events.