Tracking events

This article describes a feature from Koko Analytics Pro, which is currently only available in closed beta.

To set up event tracking with Koko Analytics, first ensure you have purchased Koko Analytics Pro and that you have the Koko Analytics Pro plugin installed and activated.

In order for Koko Analytics to track custom events, you will first need to tell it what type of event you would like to track. To do this, head over to Dashboard > Analytics in your WordPress admin area and click the Settings link in the top right corner of your screen.

Locate the Events section about halfway down the page.

You can register new events using the input field. Enter a name for your event (like “Outbound click”) and click the Add event button.

Once the event is added, you’ll be taken to a page containing some sample code snippets for how to increment the count for this event.

Usually you want to call the second example whenever an event of this type occurs.

For example, to increment the count for this event whenever someone clicks a certain button on your site, first register an event handler on the “click” event for the button element and then execute the sample code snippet from the screenshot above.

document.querySelector('#my-button').addEventListener('click', function() {
    koko_analytics.trackEvent('Outbound click', window.location.pathname);

This example increments the count for the Outbound click event with the current path on your website as its parameter. In your analytics dashboard, this will look like this:

You can see that the Outbound click event was recorded for a grand total of 3 times. Twice from the homepage and once from the contact page.

Was this article helpful? Yes / No