Browse By

Using Events in Google Tag Manager and Analytics

Events in Google Tag Manager and Analytics are a powerful one-two punch to track activity on your website. Events are commonly placed on links, images, or buttons and are then recorded in Google Analytics. This gives you the data to analyze what is working on your site and what areas can use improvement.

But how do you set up events in Google Tag Manager and Analytics?

Google Tag Manager

Tag Manager starts as a simple line of code installed on your website. See how to set up Google Tag Manager. Once the code is properly installed, you can add many types of tags that use triggers specific to what you are trying to do. In this article, I will go over how to use it to track events.

Our goal is thus: to track two images on our homepage to see which receives more clicks.

In order for any of this to work you will need Google Analytics installed on your site.

In Tag Manger we create a new tag and give it a name. The tag type is Google Analytics: Universal Analytics. Next, give names to “Category” and “Action”. These should make sense and be somewhat specific. The category can be a bit broad if it makes sense to group events. For example, you can create multiple events under a category “Home Page Block” so all actions can be tracked in this category. This will make more sense when we get to the section on Analytics.

The action label should be specific to the type of event you are tracking. For my example, something like “Big Ads” works. The label is a variable called {{Click URL}}. This will record the URL that is clicked, giving you insight of which image is clicked.

Variables in Tag Manager consist of built in and user created. I created a variable that has my Google Analytics tracking ID in it. Thus, under “Tracking ID” I can chose the variable instead of having to manually add the tracking ID.

Next, you need a Trigger. Triggers are what will enable the event to be recorded. My trigger type is Click – Just Links and will fire on Click Classes that contain “home-image”. For this tor work, you need to make sure your website is using a specific CSS class for the element you are tracking. Only these two images on my page include this click class so only these two will trigger the tag.

Google Analytics

In Google Analytics you will find Top Events under Behavior. This is where the events you created will be tracked. You can view by category, action, and label. When we drill down to the label, we see which image was clicked based on the URL recorded.

screenshot of events in Google Tag Manager and Analytics
screenshot of events in Google Tag Manager and Analytics

I operate an eCommerce site so have also added a Tag to track each time the Add to Cart button is clicked. The label recorded is the URL of the page that includes any product attributes as well as the quantity.

By collecting data via events I can examine and investigate many questions. What elements on what pages are being clicked the most? What items are being added to the cart the most and at what quantities? This is especially useful to determine if these items are placed in the cart at a higher rate than are actually being purchased. The data can also see if a price break should be offered at a certain quantity or if a particular attribute is more popular than others (i.e. color or length, etc.).

Google Analytics is incredibly powerful when used with Tag Manager. The best way to start is with an end goal in mind. This could be a call to action image, links in a header, buttons pressed, or many other actions.

Using events in Google Tag Manager and Analytics allows you to track practically anything on your site. The more data you collect, the better you can use that data to improve your website.

Want to learn more or need help? Contact me!