Track Events in Google Analytics 4 & Goals in UA using Tag Manager

Jakes van Eeden
Milk Moon Studio
Published in
7 min readOct 20, 2021

--

In this post, we’ll be looking at setting up event tracking in Google Analytics 4 and Goals in Google Analytics 3 (Universal Analytics).

So first you might have some questions, What’s GA4 & 3? Google did a nice little comparison between Google Analytics 4 Events and Google Universal Analytics Hit types here. Let’s just say that eventually Universal Analytics will be deprecated by Google and if you’re setting up a new GA account you want to go with Google Analytics 4. If you’ve already got a Universal Analytics account, now is probably the time to set up a GA4 account so it can start gathering data. If you’re setting up a new GA account you can still set up a Universal Analytics account and track that in parallel, which is probably a good idea. More on how to do that here. You’re probably want to use Tag Manager as well so help on setting that up here for our Webflow fans.

So why still use Google Universal Analytics? Well a lot of other tools, including a lot of Google’s own platforms, still only work with Universal Analytics. Google Optimise, Google Ads’ Start Ads, and other tools like Microsoft Clarity etc. to name but a few. So why not just use UA instead of GA4, like we said, UA is going to be dropped in favour of GA4 and you can’t migrate your data to GA4 so best to start gathering GA4 data now. Apart from that GA4 is just better in almost every way (including the ability to dump all your data in Google BigQuery, more on that in this post), but when it comes to custom tracking this is really important as there’s a big UA limitation, you can only create 20 Goals in a Universal Analytics Profile! So for example track the clicks on 20 buttons and forms and you’re out of space if you’re using Goals. But if you’re going to be running Smart Ads in Google Ads, you’re going to need an old style Goal in your UA Profile. So what do we do, we set up both of course.

So in summary, is this post we’ll create a Google Analytics 4 Event and a Universal Analytics Event and a Goal in your UA Profile. We’ve already done a post on setting up a form submit event and trigger here. You can use that trigger to fire both the events we’ll be creating today, and here’s a post on creating a button click trigger. The best part about using Google Tag Manager to do this is that you only create one trigger and fire both the GA4 and GA3 Universal Analytics events using the same trigger.

Let’s get started.

Step 1 — Create a Google Analytics 4 Event

Open up your Tag Manager Container and head to Tag and hit New.

Give your Tag a name, we’re going to be tracking our Contact Us button. Select Google Analytics: GA4 Event as the Tag Type, select your Configuration Tag (if you don’t have that, it’s one one you set up here). Give the event a name, we’re going with contact_us_button_clicked

Feel free to set other values, you might consider giving the User Properties a value of True for contact_button_clicked if you’d like to create audiences later or whatever.

Then add your Trigger, we’ll be using the button click trigger we set up in this post.

Hit Save.

You’ve set up a GA4 Event! Sorted! Submit and Publish the container. Then head to GA4, the events won’t start showing till tomorrow, but you can test and it’ll show under real time events. If you’d like to make this a Conversion in the meantime, head to Conversions in GA4, hit New Conversion Event, enter the event name exactly as it was in Tag Manager and Save.

As people click on the button events will start showing under events (and conversions if you added one) in the next day. You can test under Real Time in Analytics or use Preview in Tag Manager to see the Tag is firing properly.

If you’re only setting up GA4 stop here, if you’re creating a UA Event and Goal continue to steps 2 and 3.

Step 2 — Creating a Google Universal Analytics Event

First things first, if you don’t have GA UA set up or it’s not in Tag Manager do this first.

Once that’s done and you have UA in Tag Manager with a UA ID variable head to your Tag Manager Container and hit New under Tags.

Give the Tag a name (we’re tracking the Contact Us button again like we did before). Now select Google Analytics: Universal Analytics as the Tag Type. Select Event from the Track Type Dropdown, give it a Category, we’re going with buttons, for Action we’re going with click, and for Label we’re saying contact_us_click. Let’s say your click is worth $10 to you you can add 10 as a value.

Now for Google Analytics Settings select your UA ID Variable. Then for Trigger select the button click trigger we set up here or whatever trigger you set up. Hit Save, then Submit and Publish the Container.

Now you have an Event firing when the button is clicked that’ll show on Google Universal Analytics. You can test by using Preview in Tag Manager to see if the Tag is firing properly when you click on the button and or head to Google Analytics open up the UA profile you’re using, head to Realtime, select Events and click the button to see if the Event is showing under Events in in Real Time. It’s won’t show under Behavior till the next day.

Step 3 — Set Up a Conversion Goal in Google Universal Analytics

Now, let’s set up that Conversion Goal. In GA UA, hit Admin in the footer. Select the View you’d like to set this Goal up for top right. If you want it on your all Web Data View and for example you Google Ads View you’ll have to create the Goal twice, once for each View. We’re just going to use ou All Web Site Data View.

Click on Goals then New Goal.

Select Custom as the Goal Type, give the Goal a name, then select Event and click Continue.

Now enter what you used when you created the Event in Tag Manager, but leave the Value blank us less you’re filtering for a specific value you entered in Tag Manager. What you’re doing here is matching up the event you created, GA is looking for an event with a category of buttons, and a Action of click and a Label of contact_us_click.

If you entered a Value in Tag Manager and want to use that in your Goal, leave YES on. Now save and you’re done.

To test you can go to Realtime and Conversion, click the button on your site and wait and see if it shows under Goals. Remember it’ll only start showing under Conversion in the left panel a day after you set it up, same as Events under Behaviour.

You’re done. If you followed all the steps you’ll have an Event set up for GA4, UA and a Goal in UA.

Remember, if you’re having issues, hit us up in the comments and test using Preview in Tag Manager.

Just a recap on stuff you might need for this tutorial.

For more how-tos head here.

Originally published at https://www.milkmoonstudio.com.

--

--

Jakes van Eeden
Milk Moon Studio

South African, small time Webflow dev, analytics enthusiast and tech lover. I write on behalf of our Webflow design and dev agency milkmoonstudio.com