Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 

Repository files navigation

GAEvents

Avoid the arduous process of using Google Tag Manager and Macros: handle Google Analytics Event Tracking via data attributes in your HTML.

How to Use

  1. Include after you have instantiated the ga( 'create' , 'UA-XXXX-Y' ) method.
  2. Add the class names you wish to track to the _track object, or add .ga-track to your elements
  3. Populate the data-attributes on the HTML elements you wish to track
  4. Use on any a element, or add an href attribute to any other element and have the plugin treat it as an a.

Example Usage

<a href="/signup/confirm/" class="ga-track"
   data-ec="Website Signups" 
   data-ea="Confirmed Signup" 
   data-el="Internal Form Submission" 
   data-ev="10">

Available Attributes

Attribute Field Name Link
data-ec eventCategory Google Documentation
data-ea eventAction Google Documentation
data-el eventLabel Google Documentation
data-ev eventValue Google Documentation

Useful Links

Todo:

  • Remove jQuery dependency
  • Comment properly
  • Implement Promises before navigating the user

About

Handle Google Analytics Event Tracking with data attributes

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages