Event tracking in Google Analytics
Event tracking is used to track specific elements on a page, there are two primary ways of doing this either as a basic event trigger which will only measure click or to setup an event as a page view so that other metrics are captured. But it requires some setup triggers.
Method one: Events are reported under Behavior -> Events and/or Real time -> Events.
An Event can be interactive or not depending on where you use it.
Event data has four descriptors:
- Category (required) name you supply for the group of object you want to track
- Action (required) a string that is uniquely pared with each category, and commonly used to define the type of user interaction for the web object.
- Label (optional) provides additional dimensions to the event data
- Value (optional) you can use this to provide numerical data about the user
- non-interaction (optional), a boolean that indicates that the event hit will not be used in bounce-rate calculation.
This is the headings the reports are grouped by. Its best to create a standard for data in all headings. Examples suck as click, hover, submit would be in “Action”. Making sure all these headings are filled will help you create complete reports faster.
Event function in universal analytics:
ga('send', 'event', [eventCategory], [eventAction], [eventLabel], [eventValue], [fieldsObject]);
Example:
ga('send', 'event', 'Videos', 'play', 'Fall Campaign');
———————–category—event—label————
Code on page: <button type=”button” onclick=”ga(‘send’,’event’,’Click’,’Signup’,’Buttom’,0); “onmouseover=”ga(‘send’,’event’,’Hover’,’Signup’,’Bottom’,0);”>sign up</button>
Event tracking as a page view
Having your event track as a page view will allow you to get more insight on how they interact with your site. Where they leave, how long they spent on each page and you can create conversion funnels with your goals. The issue with this method is it will add to page view and session bloat.
metrics it impacts:
- Time on page
- Pages/sessions
- Entrance
- Exit
- Bounce
- Session duration
Examples:
ga('send', 'pageview', location.pathname);
------------------------------------------------
ga('send', {
hitType: 'pageview',
page: location.pathname
});
Modifying page url, Label the virtual ones distinctly so you can tell it apart.
/user/USER_ID/profile
/user/USER_ID/account
/user/USER_ID/notifications
These type of interactions are important for ajax driven single page websites where the url doesn’t change.