Crownpeak Employee
Crownpeak Employee

Add Google Analytics event tracking

Note: a Google Analytics ID is needed prior to setup. If you do not have one already, log in to your account to create one:

If you already have a Google Analytics account set up, setting up event tracking is easy.  Tracking can be used for events such as clicks, plays, etc.  Google Analytics is set up to receive information for Category, Action, Label and Value, so it is just a matter of configuring these events. 

1) Make sure you have the most current version of Google Analytics. If should be referencing "analytics.js"

2) Add your function:
<a href=”” onclick=”ga(‘send’, ‘event’, ‘Category’, ‘Action’, ‘Label’);”>

function handleClicks(event) {
  ga('send', 'event', {
    eventCategory: 'Category',
    eventAction: 'click',
    eventLabel: Label


Labels (1)