GA4 Link Click Tracking: Setting Up With Google Tag Manager
Google Analytics 4 will track external link clicks by default. But for a comprehensive picture that includes internal link clicks, we can bring in the help of Google Tag Manager (GTM). This guide will review the process to set everything up to do that. For those who want to take the next step, there’s also a link to a tutorial to set up a GA4 link click tracking report so you can easily see all of your link click data in one place.
This is a blog about tracking link clicks within your website, or from your website and going to an external location. If you are interested in tracking links from other places TO your website (like your Google business listing, email campaigns, paid media, and others) you need UTM parameters. If that sounds like you, here is video overview of understanding UTMs in Google Analytics, and here is a written guide to UTM parameters for Google business listings.
Assuming you’re in the right place for link click tracking, read on below.
Link Click Tracking Guide Summary
- Link click tracking allows you to see which links are being clicked on your website. You can track both link clicks within your site (internal links) and links off of your site (external links).
- The process for setting up link click tracking is different for Google Analytics 4 (GA4) compared to how it had been in Universal Analytics (UA). This guide is focused on GA4 link click tracking.
- For Google Analytics 4, external link clicks are one of the “enhanced measurement events” that GA4 can track for you automatically. You will see this GA4 click event named as click in your engagement reports. However, you will need to set up event tracking in Google Tag Manager to track internal link clicks. This requires the use of a tag and a trigger. Part of this process involves configuring your event parameters for your tag to set the data that will flow into your linked GA4 property.
- For GA4, you also need to register the event parameters for your internal link click event as custom dimensions so you can see the parameter data in your reports. This is a new step compared to Universal Analytics. This video will show you how to do that, but it’s worth reading about GA4 event parameters if this part is new to you.
Ready to go? Let’s do it. The video review of GA4 link tracking is below. Or if you prefer a text version, please keep on reading to review the 7 steps.
Still here? That’s great. We’ll review GA4 link click tracking first. If you’re only focused on UA, click here to skip down to bottom of the blog. But remember, UA is going away beginning in July 2023 so it’s time to start getting more acclimate to GA4. There’s usually a new GA4 training video each week on the Root and Branch YouTube channel, so you can subscribe if you want to check that out.
The Link Click Tracking Ingredients You Will Need
Before we get started, let’s make sure we have all the elements necessary. We’ll need Google Analytics and Google Tag Manager. If you are dual tagging with both GA4 and UA, you’ll need both UA and GA4 property codes deployed on your site. If you’re using only one property type or the other, obviously follow the instructions for the correct property type.
Google Analytics
We’ll be working with the GA4 property type first and will then show the steps for the Universal Analytics (UA) property type. Remember, GA4 will track your external links without the additional help of Google Tag Manager (GTM) using the enhanced measurement click event. However, you’ll need GTM to track internal link clicks. For UA, you’ll need to set up event tracking with GTM for both UA and GA4. And the link click tracking data is easier to see in UA than GA4. That’s one of many reasons, UA still makes a lot of sense if you’re considering GA4 vs. UA (reminder: use both).
For a video guide to setting up GA4 with Google Tag Manager, you can check the link below:
Video: Set up GA4 with GTM in 5 Minutes
Google Tag Manager
Like many of the more useful tracking options in Google Analytics, we need Google Tag Manager for Google Analytics link tracking. In other words, it won’t work if you aren’t using GTM in conjunction with GA4. If you aren’t currently using Tag Manager, you can head over here and learn how to deploy GTM on your WordPress site.
If you’ve got those two ingredients, we’re ready to cook up a delicious link click tracking meal.
Link Click Tracking With Google Analytics 4 (GA4): 7 Steps
Let’s walk through the the 7 steps to track those sweet GA4 clicks.
Remember: Google Analytics 4 can track outbound link clicks by default as “enhanced measurement events”. This will happen by default unless you’ve turned it off (you can check by reviewing your Data Stream in the admin section of GA4). However, it does NOT track internal link clicks. For internal link click tracking with GA4 we need to bring in the help of Google Tag Manager (GTM) and pair it up with our Google Analytics 4 property.
We’ll start with Google Tag Manager, so head over there first.
1.) In Google Tag Manager, create our trigger to isolate internal link clicks on our domain
Once you’re logged in at tagmanager.google.com hit “Triggers” from the left-hand navigation menu. Then hit the blue “New” button on the right sight of the screen. Give your trigger a name that you’ll remember. Perhaps Internal Link Click Trigger will work just fine.
Configure a trigger with the trigger type of “Click – Just Links”. You can see the trigger to fire on only some clicks. Set a condition so that the trigger will only fire on link clicks that include your domain name. You can see how I’ve set that up below.
2.) In GTM, you’ll need to configure your built-in click variables
If you haven’t previously configured your built in variables, hit “Variables” in the left-hand navigation of Tag Manager. You will see it immediately below Triggers. Hit the blue “Configure” button at the top right of the screen next to Built-In Variables.
This includes the {{Click URL}} variable that we’ll need to use in our link click tracking event parameters. I’d also recommend configuring {{Click Text}} if you want to track the relative click frequency of different anchor text link variants. And if you wan to configure all of them as I’ve done below, that is fine as well.
It only takes a second to configure by making sure the checkbox is turned on, so go wild.
3.) In GTM create your GA4 internal link click tag.
Select “Tags” in the left-hand navigation of GTM. You’ll see this immediately above “Triggers”. Now, hit the blue “New” button on the right side of the screen. Click into Tag Configuration and select “Google Analytics: GA4 Event” as your tag type. Give your tag a name. How about GA4 – Internal Link Clicks if you’re not feeling creative. Note: this tag name will only be for organizing your GTM container. It’s not the same as the event name that will actually show up in your GA4 reports. The event name I’ve used below is internal_link_click. This is the name that will show up in my GA4 reports when this tag fires.
As you can see above, you can include two event parameters to help you analyze your link click data. Those parameters are link_url with a value of {{Click URL}} and link_text with a value of {{Click Text}}. Remember those built-in variables you configured in step 2? This is where they come in handy. In two steps, you will need to register these two parameters in GA4 as custom dimensions in order to be able to see the resulting data in either GA4 reports or Looker Studio.
Note: Before you publish your container, check out the UPDATE section after Step 6 so you have the most current info.
4.) Pair your new GA4 internal link click tag with your internal link click trigger
GTM sends data into Google Analytics when a tag is triggered. The data that we’re sending is included in our GA4 link click tag that we just built. But if we don’t pair it up with the right trigger then we won’t get any data. So select your Internal Link Click trigger as the firing trigger for the tag. You can see what this looks like below.
5.) After testing to confirm all is working properly, publish your GTM container.
Testing is always a good idea. You can hit the “Preview” button in the top right of the screen to enter preview and debug mode in GTM. Once you confirm it’s working, you can publish your container by hitting the blue “Submit” button that is immediately to the right of the “Preview” button.
Congrats! You’ll now get the link click data in Google Analytics. However, if you don’t complete the next step, you’ll only be able to see this data in your Debug view. In other words, complete the next step so you don’t waste all your work.
6.) In GA4 register your two new event parameters as Custom Dimensions
We’re done with our work in GTM so now we’re going to head over to Google Analytics. So log in to your GA4 property that is associated with your GTM container.
Now, go to the “Configure” menu in the left-hand navigation. Then select Custom Definitions as you can see below. Then, hit the blue “Create custom dimensions” button to create two new event-scoped custom dimensions. These custom dimensions will allow you to see the link_url and link_text event parameter data that you created in Step 2. If you don’t register them as custom dimensions, you won’t be able to see them in your GA4 reports.
When creating your custom dimensions, you must complete the event parameter field exactly as you wrote your Parameter name in your GA4 tag creation. For the “Dimension name”, enter whatever you’d like to see in your reports. This is how that dimension will show up.
You can see the two new dimensions I created for Link Click Text and Link Click URL in the red box below.
UPDATE: Do I Really Need Those Event Parameters and Custom Dimensions?
The short answer is no, but you still might want to include them.
Here’s the longer story:
Google Analytics 4 is continually getting updated and improved by GA4. One nice thing is that you should now be able to get both Link text and Link URL as dimensions *without* going through the process of setting those event parameters in your GA4 event tag and then registering them as custom dimensions. This is good news.
So why would you want to include them and do the extra work mentioned here? I can think of three reasons:
- If you make certain changes to your enhanced measurement events in the future, these “built in” dimensions may no longer be available.
- Creating event parameters in GA4 Event tags and then registering them as custom dimensions is an important part of learning GA4. Could be a good time to get some practice!
- When looking at your Event reporting in your standard reports, you’ll only be able to see the event parameter detail via the custom dimensions and not the built in dimensions. Check this out below.
If you do go through the process of registering these custom dimensions, here is what you will see when you select your dimensions in a GA4 Exploration.
Some Screenshots
Let’s imagine we’ve hit the blue plus icon to add dimensions to our Exploration. As you can below, we’ve started typing “link” in the search bar. You can see the “Link Click Text” and “Link Click URL” custom dimensions are available. You’ll see the same if you go through the steps recommended in this guide and video.
You can also see “Link text” and “Link URL” dimensions that are available. This holds the same information as the custom dimensions.
Here’s what it looks like if you add all four of those dimensions (along with page path) to a report for the internal_link_event. You can see the Link Click URL and Link URL dimensions have the same data. The same goes for the Link Click Text and Link text dimensions.
So, should you go through the process of setting these two event parameters and registering the custom dimensions? I think it’s still worth considering for the three reasons outlined above, but it’s completely up to you and you’ll be fine either way.
7.) Optional: Create a report in Google Data Studio that will show ALL of your GA4 link clicks.
This will combine the internal link click data that you’ve just set up with the external link click data that is tracked automatically by GA4 enhanced measurement.
If you’d like to make a copy of the report, you can find a link to do that in the description of the video linked below.
Beyond Link Click Tracking in Google Analytics
There’s always a lot to learn and a lot to do with Google Analytics. If you’re hungry for more, consider checking out this page of GA4 questions and answers. It’s getting some regular updates these days!
If you’re interested in more digital marketing tips and tricks like this, head on over to YouTube and check out the Root and Branch channel. I do my best to respond to all questions and comments over there. You can learn more about Root and Branch or connect with me (Hi, I’m Zack) over on LinkedIn.
Final Thoughts
If you have questions or suggestions or your own tips to share, feel free to drop them in the comments below. Thanks and have fun out there!
thanks you~it’s really help when I find out in GA4 the link_text is all null by default 🙂
Great. Thanks Lisa!
How can we set up reports on button clicks in GA4? I’ve wasted too much time trying to figure it out.
Hi there Ryan, thanks for reading and thanks for the question. Much of what is outlined in this link click tracking guide should apply to button click tracking in GA4. But to get you the most satisfactory answer, I’ll make you this offer:
I could check out your site. I could then make a tutorial video designed to track what you want to track.
If you’re interested, just connect with me (https://www.linkedin.com/in/zackduncan) and then send me a message with the specific site you want to track and what specific button click you want to track. You’d also need to give me temporary access to Google Tag Manager. I wouldn’t need publish access so I can’t actually set anything live without your approval. I’ll check it out and if I can confirm that I can do it (which I think I can). The only “cost” would be that you’d need to be willing to have your site serve as an example in a future tutorial blog and / or video.
Up to you!
Have a good one.
Zack
Thanks for the tutorial. Would it not be better to use the external link -build in- parameters and use the build in paramater ‘outbound’ = false? Google recommends to first use recommended events and only if not possible to use your own? Or to I overlook something?
Hi Keesjan, thanks for the thoughtful question. I have a 2-part response:
Part 1: For me, having a separate event for internal clicks vs. external clicks makes my GA4 reports (in Explorations) easier to build and more useful than they would be otherwise. But, that leads to part 2 below…
Part 2: Full disclosure, I have not tried setting it up the way that you have suggested. If you’ve done this and had good luck with it, please feel to share! I am always up for learning new things, and continue to need to that!
Thanks!
Zack
Would i asked about how to make event for trackling click anchor text in GA4 mister?
Thank you
Hello! The embedded video for GA4 internal link click tracking should do this for you. You just need to set an event parameter for ‘link_text’ when you create the event in GA4. You’ll also need to register that event parameter as a custom dimension in GA4 after you’re done, so you can see that data in your reports.
Watch this tutorial first (GA4 event creation): https://youtu.be/sF_KPPhzF-Y
Watch this video second (registering custom dimensions): https://youtu.be/Gcn_I-xHnvU
Best of luck to you!
very useful.
i’ve got a wordpress site with two sidebars that each have about 40 graphic images, each with its own title / header above the graphic, and the graphic itself with a link to another site; all in widget areas. I’d like to grab the event a visitor would make when they click. Previously on GA3, when i added some on click send event code in the link i wanted to track. i could find it in my ga3 reports, in top events. The unique text with the number of clicks was of value in these reports. Now, apparently, i can use , or learning how to use, the GTM to do it, but i am finding it difficult to figure it out. I’ve been watching videos but i am starting to get a bit impatient. Each widget has its own id’s. Can you send me on the right path?
Hi Edward, thanks for your question. If you were tracking this click data in your Universal Analytics property (GA3), you would have had a trigger and tag set up in Google Tag Manager to send the event data into GA3. That’s the only way I know how to track this event click data, unless your site was somehow hard coded for it. Let me know if that’s right or if I’m missing something.
If I’m right, I would recommend using the exact same click trigger you had for GA3 (since it was clearly working) and pairing it up with a new GA4 event tag. If you need to create the trigger from scratch, I’d recommend trying to do it with a combination of click URL (the target URL of each click) and perhaps also the click class. Here’s a video I had made of doing some click tracking myself where I combined both of those methods. You’d need to do testing in Google Tag Manager (preview mode) to see what specific things are happening when you make those clicks.
https://youtu.be/JOFtjLpwBLE
I hope this helps. Wish you all the very best.
Very helpful. Thank you so much.
Hi,
Nice and very informative post. Thank you.
I want to ask a question. In old analytics, there was “ready to use” reports, like “Top Events”. In that report I can see outgoing link clicks and source country etc. It is really great. But in GA4, I could not find it. Probably it is not a ready-to-use report. How can I find that kind of reports?
Sincerely.
Hello Metin,
Thanks for reading and your thoughtful question. I totally agree with you: UA made things much easier than GA4, especially when it comes to event reporting like this.
I built a report somewhat similar to what you’re describing showing the top links clicked (internal and external) using Looker Studio / Data Studio. I didn’t include country, but that should be easy to add as a dimension if you can follow the rest of this video tutorial. The link is below.
https://youtu.be/yrKLXHy4hHk
Best of luck!
Good starting point.
Thank you.
Any reason why enhanced measurements save would be disabled? I can toggle things on/off but the save button is greyed out so I can’t save. Have asked in G forums but no replies and they just locked the post so can’t get an answer
Hi Kes, I’m sorry I haven’t seen this. Do you have the highest level of access in the account? My assumption would be that it could be related to access rights, but it’s nonetheless quite odd that you can access the toggle on / off but not the save. Wish I had something more helpful to offer.
Great tutorial, thanks! I have a related question…Let’s say I have A/B testing on a web page. Two banners link to the same page. Boss wants to know how many people clicked on the left banner, and how many clicked on the right banner. Do you have a separate article or a video on setting up that? Thank you. Great job
Hi Tee. So both banners are on the same page and link to the same page, right? If so, I understand why you’d need to track each button with something other than the destination of the URL click. And I see why you couldn’t differentiate based on the page that the banners were on. Here’s a blog showing another way to track button clicks that *might* help: https://www.rootandbranchgroup.com/ga4-button-click-tracking/
If this doesn’t work another way you could test it would be with some kind of time test. For example, let banner A run for 7 days and collect data. Then, let banner B run for the same time and compare the results to see what generates more click activity. Good luck.
I went into debug mode in GTM and see “Tags Fired” next to the Internal Link Click Trigger (and it also says “Google Analytics: GA4 Event – Succeeded”).
However, when I’m looking at this Event in GA4, or creating an Exploration to look at the parameters of internal_link_click and internal_link_url, it appears as “(not set)”. I have both of these parameters set as Custom definitions. Any idea why values aren’t pulling in for either parameter/dimension?
Hi Molly, are you still having the issue? I suspect it might have had to do with timing, since GA4 can sometimes take some time to catch up to new events and event parameters (custom dimensions).
One other thing to check would be to try using the “Link text” and “Link URL” link dimensions when you are selecting your dimensions in your Exploration. These were not always available in GA4 (hence the recommendation for the custom dimensions), but they should be available by default now in GA4. I’ll be updating the blog to reflect this.
I read this paragraph fully regarding the difference of hottest and earlier
technologies, it’s awesome article.
What’s up it’s me, I am also visiting this web page daily, this web page is in fact pleasant and the users are actually sharing pleasant thoughts.
Because the admin of this web page is working, no uncertainty very soon it will be renowned, due to its feature contents.
Hey, thank you for this post. It has greatly enriched me. Nevertheless, I still have the following questions;
How do I enable Google Analytics 4 “form submit” option. Is there code I need to add to the website to allow for that level of tracking? Does the page admin have to log-in an update those setting?
please I will appreciate a step by step direction on how to achieve this. An email will be appreciated.
Thank you
Hello there. Tracking your form submissions will partially depend on your individual setup of your site. If your successful form submissions redirect to a thank you page, you can use this video tutorial. https://youtu.be/mc9BHAmnrMI
That should work for all situations. If you use something like Contact Form 7 (a WordPress plugin for forms), you won’t redirect to a thank you page. I have a video review of how to track that, in case that’s your setup: https://youtu.be/I2P5zVaiKXk
Best of luck.
Thank you Zack. Please can you assist me with this video (tutorial. https://youtu.be/mc9BHAmnrMI) write up just like you had in your other videos.