Having a consistent naming convention for event tracking is super important. If you’re not consistent it can be really tricky to understand what your website users are doing.
However, there doesn’t seem to be a consensus on the right way to do it. This is my take on how to name your events.
Google Analytics events
An event is when a user does something on your website. For example clicks on a link or scrolls down the page.
When an event fires it can be made up of four components:
I use ‘Category’ to highlight which page template the event has fired on. For example:
- Category page
If you have a particular big site I would add a section prefix. For example a large food website with products and recipes could be structured like this:
- Products | Homepage
- Products | Category page
- Products | Product
- Recipes | Homepage
- Recipes | Category page
- Recipes | Recipe
I use ‘Action’ to describe the component the event fired on. For example a component might be a button or a share icon. Here’s a list of some other components a website might have:
If an event doesn’t fit any of these I have the default action set as ‘Body link’.
I use ‘Label’ to add the link text and the parent elements name.
For example one of the components on my site is a card. A card is used in a number of places. One place is at the bottom of a blog post under the heading ‘More posts’.
This is what it looks like on the site:
And this is how it appears in GA – merging the parent elements name ‘More posts’ and the link text:
Value is optional and differs from all the other event components. It is integer rather than a string. Basically this means it has to be a number.
For example you could use it to assign a monetary value once a particular event has taken place.
There isn’t any advice I can give about using it but for completeness I added it to this post.
Exceptions to the rule
Scroll is one action which doesn’t fit neatly into this system ie how far a user has scrolled down a page. If you want to track scroll I just give it an Action of ‘Scroll’ and a Label of either:
- Scroll 100%
- Scroll 75%
- Scroll 50%
- Scroll 25%
If a video is added to a page I call the Action ‘Video’ and the Label a mixture of what the user did to the video and the video name such as:
- Video played | Insert video name
- Video watched 25% | Insert video name
- Video watched 50% | Insert video name
- Video watched 100% | Insert video name
Whether you use the format I use or not, the important bit of advice is to be consistent and document it.
Event Category, Action and Label are hierarchical. This means your Category should be the least specific, Action should be a bit more specific and the Label should be the most specific description.
How you implement the event tracking requires a bit of developer support. I use Google Tag Manager to get the data into Google Analytics. Equally you could use a non Google product like Ensighten.
To ensure the tag manager follows my naming convention I use a mixture of the data layer and data attributes – but that’s another blog post for another day.