How to set up GA4 Custom Events via Google Tag Manager

Table of Contents for how to set up GA4 Custom Events via Google Tag Manager

  1. Custom events overview
  2. How to set up custom events GA4 using GTM
  3. Debugging custom events
  4. FAQ

Custom events overview

An event is the user’s interaction/activity with a web page element embedded on a website and/or mobile app.

There are four categories of events in Google Analytics 4:

  1. Automatically collected events
  2. Enhanced measurement events
  3. Recommended events
  4. Custom events

In this article, we are focusing on custom events only. Custom events are the events in GA4 (Google Analytics 4) that you create and use. 

Google recommends that before you create a custom event, make sure that there is not an automatic, enhanced measurement or recommended event that already provides what you need.

So, custom events can be any interaction on your website that is not tracked by default. For example, button click, sign up events, form submission, etc. Now let’s see how custom events are set up in GA4 using Google Tag Manager

How to set up custom events GA4 using GTM

To set up GA4 custom events via Google Tag Manager follow the steps below:

Step-1: Log in to your GTM account and then click on ‘Tags’ in the left-hand side menu:

ga4 custom events gtm Tags

Step-2: Click on the ‘New’ button to create a new tag:

ga4 custom events gtm new

Step-3: Name your tag ‘Button Click’ and then click on ‘Tag configuration’.

ga4 custom events gtm name

An overlay will appear at the right-hand side with a list of tag templates:

ga4 custom events gtm event

Step-4: Click on ‘Google Analytics: GA4 Event’.

Step-5: Click on the ‘Select Configuration Tag’ drop-down menu:

ga4 custom events gtm config

Step-6: If you have setup configuration tag then select that tag, otherwise select ‘None- Manually Set ID’ from the drop-down:

ga4 custom events gtm manu

Step-7: Enter the Measurement ID in the input box:

ga4 custom events gtm config 2

You can find your measurement ID in the ‘Admin’ section under ‘Data Streams’.

measurement id

Step-8: Enter ‘Button Click’ in the ‘Event Name’ text box:

ga4 custom events gtm config 3

The event name you provide here will appear in your GA4 reports.

Step-9: Click on the ‘Event Parameters‘ drop-down menu:

Event parameter

Step-10: Click on the ‘Add Row’ button:

add row

You should now see the two new text boxes: ‘Parameter Name’ and ‘Value’:

parameter fields

Step-11: Type ‘button_name’ in the ‘Parameter Name’ text box:

button name

Step-12: Click on the ‘+’ button under the ‘Value’ text box:

plus icon

Step-13: Click on the ‘Click Text’ variable:

click

Your final set-up may look like the one below:

configuration

Note: Adding event parameters to the event is optional.

Step-14: Click on the trigger button to create a new trigger:

triggering

Step-15: Click on the ‘+’ button at the top right-hand side of your screen:

trigger button

Step-16: Name your trigger and then click on the ‘Choose your trigger type’ button:

name trigger

Step-17: Click on ‘All Elements’ trigger type:

All elements 1
trigger type

Step-18: Click on ‘Some Clicks‘:

some clicks

Step-19: Set the following trigger condition:

trigger condition

Here the trigger condition will fire the tag only when the click classes contains ‘godef-btn-text’

You would need to find the class name of your button element. Don’t use the class name that I have used. 

Step-20: Click on the ‘Save’ button (at the top right-hand side of your screen) to save your new trigger.

Your entire tag set-up may look like the one below:

Tag configuration 1

Step-21: Click on the ‘Save’ button (at the top right-hand side of your screen) to save your new tag.

Debugging custom events

Step-22: Click on ‘Preview’ button:

ga4 custom events gtm preview

A new tab will open with GTM Preview Mode.

Step-23: Add the URL of the page where the button you want to track is available and then click on the ‘Start’ button:

ga4 custom events gtm start

You will now be automatically redirected to a new tab in your browser window which shows the web page whose URL you typed.

In my case the page looks like the one below:

ga4 custom events gtm button

It contains a ‘Read More’ button. I am going to track clicks on this button.

Step-24: Click on the button.

Step-25: Navigate back to the preview window of GTM and check whether or not your tag is fired on the click event:

ga4 custom events gtm fired

As you can see from the screenshot above, our button click has fired.

Step-26: Click on the ‘Button Click’ tag. You should now see the ‘Tag Details’ page like the one below:

tag details

Step-27: Navigate to the ‘Realtime’ report of your GA4 reporting view:

realtime 3

You should now be able to see the button click event being reported by GA4:

ga4 custom events gtm realtime 1

Congratulations, you have successfully set up a custom event for GA4 using Google Tag Manager.

After 12-24 hours have elapsed, your button click event should appear in your ‘Events’ report:

Event in GA4

Frequently Asked Questions About How to set up GA4 Custom Events via Google Tag Manager

What are custom events in Google Analytics 4?

Custom events are the events in GA4 (Google Analytics 4) that you create and use. Google recommends that before you create a custom event, make sure that there is not an automatic, enhanced measurement or recommended event that already provides what you need.
So, custom events can be any interaction on your website that is not tracked by default. For example, button click, sign up events, form submission, etc.

What are automatically collected events in Google Analytics 4?

Automatically collected events are triggered by the basic interaction with your website or mobile application. Unlike other custom events, you don’t have to add or modify code to collect these events and it is tracked directly from your SDK or gtag.js code.

What are examples of custom events collected in Google Analytics 4?

Well, any event which is not tracked by default in the automatically tracked events and enhance measurement events can be tracked as custom events. Following are few examples of custom events that can be tracked.

1. Navigation Menu Clicks
2. Button Click
3. Internal Link Clicks
4. Login/Log Out events
5. Subscription events

Other articles related to GA4 (Google Analytics 4)

#1 GA4 Intro

  1. What is GA4 (Google Analytics 4) – The Apps + Web Property?
  2. Key Benefits of Using Google Analytics 4 (GA4)
  3. How to upgrade to GA4 (Google Analytics 4)
  4. Google Analytics 4 (GA4) vs Universal Analytics – What is the difference?
  5. Google Signals GA4 – See demographics (gender, age) in Google Analytics 4
  6. Understanding Google Analytics Measurement ID (GA4)
  7. Google Analytics 4 training and tutorial
  8. Using the GA4 test property

#2 GA4 Integration

  1. How to connect GA4 (Google Analytics 4) with Google Data Studio
  2. How to link GA4 (Google Analytics 4) with Google Ads
  3. GA4 BigQuery – Connect Google Analytics 4 with BigQuery

#3 GA4 Events

  1. GA4 (Google Analytics 4) Event Tracking Setup Tutorial
  2. How to set up GA4 Custom Events via Google Tag Manager
  3. GA4 (Google Analytics 4) Enhanced Measurement Tracking Tutorial
  4. Events Report in Google Analytics 4 (GA4)
  5. GA4 User Properties (User Scoped Custom Dimensions) – Tutorial
  6. Event Scoped Custom Dimensions in GA4 – Tutorial

#4 GA4 Conversions

  1. GA4 (Google Analytics 4) Conversion Tracking Guide
  2. How to import conversions from GA4 property to your Google Ads account

#5 GA4 Dimensions and Metrics

  1. GA4 Metrics Tutorial with Free Google Analytics 4 Ebook
  2. GA4 Custom Metrics Tutorial
  3. GA4 Dimensions Tutorial
  4. GA4 Custom Dimensions Tutorial

#6 GA4 Ecommerce

  1. GA4 (Google Analytics 4) Ecommerce Tracking via GTM – Tutorial

#7 GA4 Specialized Tracking

  1. Cross Domain Tracking in GA4 (Google Analytics 4) Setup Guide
  2. GA4 Site Search – Tracking Site Search in Google Analytics 4
  3. GA4 (Google Analytics 4) Scroll Tracking Tutorial
  4. How to Install Google Analytics 4 on Shopify
  5. Self-referral Google Analytics 4 – Referral exclusion GA4
  6. GA4 Data Import Tutorial

#8 GA4 filters

  1. GA4 filters – Understanding data filters in Google Analytics 4
  2. How to create and test filters in Google Analytics 4 (GA4)?
  3. Exclude internal traffic in GA4 (Google Analytics 4) via IP filter

#9 GA4 Analysis Hub

  1. Analysis Hub Google Analytics – Exploration Report in GA4 (Google Analytics 4)
  2. How to use the user lifetime report in Google Analytics 4 (GA4)
  3. How to use path analysis report in Google Analytics 4 (GA4)
  4. How to use Segment Overlap Report in Google Analytics 4 (GA4)
  5. How to use the Funnel Analysis Report in Google Analytics 4 (GA4)

#10 GA4 Advanced

  1. How to use Debug View report in Google Analytics 4 (GA4)
  2. Understanding GA4 measurement protocol
  3. How to create a remarketing audience in Google Analytics 4 (GA4)
  4. GA4 Audiences – Creating custom audience in Google Analytics 4
  5. How to build comparison (Advanced segment) in Google Analytics 4 (GA4)

#11 GA4 Reporting

  1. How to create custom insights in Google Analytics 4 (GA4)

Register for the FREE TRAINING...

"How to use Digital Analytics to generate floods of new Sales and Customers without spending years figuring everything out on your own."



Here’s what we’re going to cover in this training…

#1 Why digital analytics is the key to online business success.

​#2 The number 1 reason why most marketers are not able to scale their advertising and maximize sales.

#3 Why Google and Facebook ads don’t work for most businesses & how to make them work.

#4 ​Why you won’t get any competitive advantage in the marketplace just by knowing Google Analytics.

#5 The number 1 reason why conversion optimization is not working for your business.

#6 How to advertise on any marketing platform for FREE with an unlimited budget.

​#7 How to learn and master digital analytics and conversion optimization in record time.



   

My best selling books on Digital Analytics and Conversion Optimization

Maths and Stats for Web Analytics and Conversion Optimization
This expert guide will teach you how to leverage the knowledge of maths and statistics in order to accurately interpret data and take actions, which can quickly improve the bottom-line of your online business.

Master the Essentials of Email Marketing Analytics
This book focuses solely on the ‘analytics’ that power your email marketing optimization program and will help you dramatically reduce your cost per acquisition and increase marketing ROI by tracking the performance of the various KPIs and metrics used for email marketing.

Attribution Modelling in Google Analytics and BeyondSECOND EDITION OUT NOW!
Attribution modelling is the process of determining the most effective marketing channels for investment. This book has been written to help you implement attribution modelling. It will teach you how to leverage the knowledge of attribution modelling in order to allocate marketing budget and understand buying behaviour.

Attribution Modelling in Google Ads and Facebook
This book has been written to help you implement attribution modelling in Google Ads (Google AdWords) and Facebook. It will teach you, how to leverage the knowledge of attribution modelling in order to understand the customer purchasing journey and determine the most effective marketing channels for investment.

About the Author

Himanshu Sharma

  • Founder, OptimizeSmart.com
  • Over 15 years of experience in digital analytics and marketing
  • Author of four best-selling books on digital analytics and conversion optimization
  • Nominated for Digital Analytics Association Awards for Excellence
  • Runs one of the most popular blogs in the world on digital analytics
  • Consultant to countless small and big businesses over the decade
error: Alert: Content is protected !!