NickFoster
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: 
https://analytics.google.com/analytics/web/

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=”www.examplewebsite.com” onclick=”ga(‘send’, ‘event’, ‘Category’, ‘Action’, ‘Label’);”>
or
<script>

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

</script>

Labels (1)

Can't find what you are looking for?

Find Answers

Search our DG Forum to find answers to questions asked by other DG users.

Ask a Question

No luck? Ask a question. Our Product and Support teams are monitoring the Forum and typically respond within 48 hours.

Ask a Question