2. Understanding Event Tracking
Events are user interactions with content that can be tracked independently
from a web page or a screen load. Downloads, mobile ad clicks, gadgets,
Flash elements, AJAX embedded elements, and video plays are all
examples of actions you might want to track as Events.
Use Events to collect data
about interactions with your
content that wouldn’t be
tracked with normal analytics.
3. Website Conversion Tracking
ANATOMY OF EVENT TRACKING CODE
Event tracking allows you to measure how users interact with the content of your website. For
example, you might want to measure how many times a button was pressed, or how many
times a particular item was used in a web game.
An event consists of four values that you can use to describe a user's interaction:
Value Type Required Description
Category String Yes Typically the object that
was interacted with (e.g.
button)
Action String Yes The type of interaction
(e.g. click)
Label String No Useful for categorizing
events (e.g. nav buttons)
Value Number No Values must be non-negative.
Useful to pass
counts (e.g. 4 times)
4. Website Conversion Tracking
ANATOMY OF EVENT TRACKING CODE
ga('send', 'event', 'category', 'action');
ga('send', 'event', 'category', 'action', 'label');
ga('send', 'event', 'category', 'action', 'label', value); // value is a number.
5. Website Conversion Tracking
Example
Say you have a link to download a PDF on your page:
It looks something like this: <button id=“button”>Download</button>
To add an event to this button using JQuerry, use the below code:
<script>
$('#button').on('click', function() {
ga('send', 'event', 'button', 'click', 'nav-buttons‘,1);
});
</script>
Optional value