how to track internal links ga4

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).

google analytics png

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.

google tag manager png

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.

ga4 link click trigger

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.

configure built in click variables

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.

ga4 link click tag

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.

ga4 link click tag paired with trigger

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.

register link click tracking parameters as custom dimensions in ga4

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:

  1. If you make certain changes to your enhanced measurement events in the future, these “built in” dimensions may no longer be available.
  2. 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!
  3. 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.
link click url and link click text dimensions

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.

custom vs built in link 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.

sample ga4 report with link 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.

click to yt

 

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!

42 replies
    • Zack_Duncan
      Zack_Duncan says:

      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

      Reply
  1. Keesjan
    Keesjan says:

    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?

    Reply
    • Zack_Duncan
      Zack_Duncan says:

      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

      Reply
    • Zack_Duncan
      Zack_Duncan says:

      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!

      Reply
  2. edward I rosenthal
    edward I rosenthal says:

    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?

    Reply
    • Zack_Duncan
      Zack_Duncan says:

      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.

      Reply
  3. METIN KARAL
    METIN KARAL says:

    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.

    Reply
    • Zack_Duncan
      Zack_Duncan says:

      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!

      Reply
  4. Kes
    Kes says:

    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

    Reply
    • Zack_Duncan
      Zack_Duncan says:

      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.

      Reply
  5. Tee
    Tee says:

    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

    Reply
    • Zack_Duncan
      Zack_Duncan says:

      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.

      Reply
  6. Molly Desrosier
    Molly Desrosier says:

    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?

    Reply
    • Zack_Duncan
      Zack_Duncan says:

      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.

      Reply
  7. Ngozi
    Ngozi says:

    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

    Reply
  8. Zack_Duncan
    Zack_Duncan says:

    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.

    Reply

Trackbacks & Pingbacks

  1. […] custom event to track internal link clicks […]

  2. […] my testing, the engagement_time_msec parameter was passed with the scroll event, the internal_link_click event, the click event (external link click), and the user_engagement […]

  3. […] could be something like scroll depth tracking, or video plays, or page timer tracking, or link click tracking. In this case, the event we’re going to be tracking is a specific click from a specific page […]

  4. […] the help of Google Tag Manager. Things like button click tracking, custom scroll tracking, internal link click tracking, page timer tracking, and more all fit in this category. The linked pages include instructions for […]

  5. […] Build a report showing all Links clicked with Looker Studio: (note, this requires setting up this custom event for internal link click tracking). […]

  6. […] There are a number of guides on this website for GA4 event tags like advanced scroll tracking, internal link click tracking, and more. However, it’s possible to create some custom events without Tag Manager. […]

  7. […] this method. In this image, there is a misconfiguration of the auto event variable (due to the internal link click), resulting in the tag not being […]

  8. […] from your website’s domain to a different domain is referred to as its redirect. Because the internal link click is responsible for the tag not responding, the auto event variable is incorrect in the image […]

  9. […] clicking this button, you will be able to track all internal link clicks on your site. Next, make sure all click-related built-in variables are turned on. You must tick […]

  10. […] GA4 will do that for you with enhanced measurement. Maybe you can invest your time learning about GA4 link click tracking or about GA4 events in […]

  11. […] Manager also enables some more advanced Google Analytics tracking and measurement techniques like link click tracking, scroll depth tracking, timer tracking, and other “events” that can’t be tracked […]

  12. […] say you have set up a GA4 custom event with the help of Google Tag Manager to track internal link clicks. You have named your event internal_link_click. Every time your event tag fires, GA4 will record an […]

  13. […] How to set up link click tracking in GA4 (vs. UA) […]

  14. […] were anything like me, you likely set up some GA4 event tags in Google Tag Manager. Maybe it was internal link click tracking or page timer tracking or even a completed form submission. For each event, you set some specific […]

  15. […] for more on Google Analytics, check out this guide on implementing link click tracking and this comparison on GA4 compared to […]

  16. […] by platform comparison of creating event tracking, consider coming back and reviewing this guide to Google Analytics link click tracking in UA vs. GA4 once you have a strong grasp of the basics and setup […]

  17. […] here, have fun exploring and practicing. If you haven’t done it already, consider setting up Google Analytics link click tracking to get deeper insight into your data. And if you have questions or suggestions or your own tips to […]

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published. Required fields are marked *