Last Updated:
June 21, 2021
by
Jesse Langstaff
| Version: 8
| 2,116 views
| 0 followers
members are following updates on this item.
With Google Analytics connected to your digital workplace, you can set up Event Tracking to track how users interact with components of your page. You can find these events in Google Analytics under Behavior > Events location. You can then measure these metrics against the desired goal. For more information, check out Google's video about How to set up event tracking.
Setting up event tracking requires some experience with JavaScript.
Google Tag Manager gives you an alternative method of tracking events in your digital workplace. To track events this way, you will need to add Google Tag Manager to your workplace and then set up tracking via triggers and tags.
Google's developer API defines the basic functions that Google Analytics uses to record events. However, for event tracking to work, you must attach these functions to the HTML elements on a page. You can track the clicking of an element with the following code snippet (Note: Your digital workplace uses the legacy ga.js code by default)
(function($) { $(function() { $('{identifier}').click(function(evt) { _gaq.push([ '_trackEvent', '{Category}', '{action}', '{label}', {value} ]); }); }); })(jQuery);
Modifying this script:
Where you place this script depends on what HTML element you want to track. If the element only exists on specific pages, place your script in the JavaScript section of those page's Advanced Page. If you are tracking an element that occurs on every page of your workplace, you should place your script in the header of your digital workplace.
After creating events, you can then connect them to goals within Google Analytics (Admin > View Column: Goals).