Events With Google Analytics

GA icon for events

One of the useful features of Google Analytics is the ability to track specific events. It gives you insight into how users filled your forms or on which buttons they clicked inside the video player. You are getting into the world of measuring actions inside your pages and not just between them. In the demo below we will see how to track a ‘download’ button click event and how to track the form filling. It’s super useful when you wish to learn if users use the Autofill feature with your forms.
It’s an easy API that you should leverage, so let’s jump into it.


Events (in our world of Google analytics) are user interactions with content that can be tracked independently from a web page or a screen load. Downloads, mobile ad clicks, gadgets, forms, embedded elements and video plays are all examples of actions you might want to track as Events.


Event hits can be sent using the send command and specifying a hitType of an event.
The send command has the following signature for the event hit type:

ga('send', 'event', 
   [eventCategory], [eventAction], 
   [eventLabel], [eventValue], 

You need to make sure to add the GA script tag to your page.
Something similar to:

< script>
 (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
 ga('create', 'UA-XX-1', 'auto');
 ga('send', 'pageview');
< /script>

Please make sure to change the line with UA-XX-1 to your Google analytics id.

Event fields

The following table summarizes the event fields:

Field Name Value Type Required Description
eventCategory text yes Typically the object that was interacted with. For example:'registertion form'
eventAction text yes The type of interaction (e.g. 'contact details')
eventLabel text no Useful for categorizing events (e.g. 'first name')
eventValue integer no A numeric value associated with the event (e.g. 2)

The last two parameters are optional and if you are using the eventValue – make sure to use an integer.

Live Demo



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s