To track affiliate clicks in GA4, send a custom event (for example affiliate_click) every time a visitor clicks one of your affiliate links, add parameters such as the link URL and the program name, then mark that event as a key event. Google Tag Manager is the cleanest way to do it: one Link Click trigger, one GA4 event tag, and a couple of custom dimensions.
GA4 can also log outbound clicks on its own through enhanced measurement, but that catches every external link, not just the ones that earn you money. This guide shows both routes, the reports that reveal your money pages, and the mistakes that make click data unreliable.
What GA4 can and cannot tell you about affiliate clicks
Be clear about the job before you build anything. GA4 measures what happens on your site: which pages people land on, which links they click and where they came from. It does not see what happens on the merchant's site, so it cannot tell you whether a click turned into a sale, a free sign-up or nothing at all.
That makes GA4 the top half of your measurement picture. The bottom half (conversions and commission) lives in your affiliate network dashboards or your tracker, joined to your clicks by sub-IDs. Used together, you can work out earnings per click for each page, which is the number that decides where you spend your time.
| Question | GA4 | Network or tracker |
|---|---|---|
| Which pages send the most affiliate clicks? | Yes | Only with sub-IDs |
| Which traffic sources produce clicks? | Yes | Only with sub-IDs |
| Did the click convert, and for how much? | No | Yes |
| Which link position or button style gets clicked? | Yes, with parameters | Rarely |
Option 1: GA4 outbound link tracking with enhanced measurement
If enhanced measurement is switched on for your web data stream (Admin, Data streams, your stream, Enhanced measurement), GA4 already records outbound clicks. It sends an event called click with an outbound parameter set to true, plus parameters including link_url, link_domain, link_classes and link_id.
This is a reasonable starting point for a small site, but it has three weaknesses for affiliates:
- It counts every external link. Links to Wikipedia, a regulator or your social profiles land in the same bucket as your affiliate links.
- It misses internal redirects. If your affiliate links go through a path on your own domain, such as /go/merchant/, GA4 does not treat the click as outbound, so it is not recorded.
- The useful parameters are hidden. Link URL and link domain do not appear in standard reports until you register them as custom dimensions.
You can filter the click event by link domain in an exploration, but if affiliate income matters to you, a dedicated event is worth the extra twenty minutes.
Option 2: Track affiliate clicks with Google Tag Manager
Google Tag Manager lets you define exactly what counts as an affiliate click and attach the details you want to report on. The steps below assume GA4 is already installed through Tag Manager with a Google tag.
Step 1: Decide how to identify affiliate links
Pick one rule that matches all your affiliate links and nothing else. The most reliable options are:
- A redirect path, such as every URL containing /go/ or /out/ (common if you use a link manager or redirect-based links).
- A rel attribute or CSS class, such as links with rel="sponsored" or a class like aff-link.
- A list of network and tracking domains, written as a regular expression. This works but needs updating every time you join a new program.
Step 2: Enable the click variables
In Tag Manager, open Variables, click Configure under Built-In Variables and tick Click URL, Click Text, Click Classes and Click Element. These give your tag something to read when a link is clicked.
Step 3: Create a Link Click trigger
- Go to Triggers, New, and choose Click – Just Links.
- Select Some Link Clicks.
- Add your rule, for example Click URL contains /go/ or Click URL matches RegEx with your list of affiliate domains.
- Name it clearly, such as "Link click – affiliate".
Step 4: Create the GA4 event tag
- Create a new tag of type Google Analytics: GA4 Event and point it at your measurement ID.
- Set the event name to affiliate_click (lowercase, underscores, no spaces).
- Add event parameters: link_url = {{Click URL}}, link_text = {{Click Text}}, and, if you can extract it, affiliate_program (for example from a data attribute on the link) and link_position (such as table, button or in-text).
- Attach the trigger from step 3 and save.
Step 5: Test before you publish
Use Tag Manager's Preview mode, click a few affiliate links on a staging or live page and check that the tag fires once per click. Then open DebugView in GA4 (Admin, Data display, DebugView) and confirm affiliate_click arrives with your parameters. Click a non-affiliate external link too, to prove it does not fire.
Common mistake: links that open in a new tab, or redirect instantly, can occasionally fire before the tag finishes sending. If preview shows the trigger firing but GA4 receives nothing, check for JavaScript on the page that intercepts clicks, and test in a browser with ad blocking switched off before assuming your setup is broken.
Register custom dimensions and mark a key event
GA4 collects your parameters straight away, but you cannot use most of them in reports until you register them. In Admin, open Custom definitions, then Create custom dimension. Choose Event scope and enter the parameter name exactly as you sent it, for example affiliate_program or link_position. Registered dimensions only populate from the moment you create them, so do this on day one.
Next, mark affiliate_click as a key event (GA4's current name for what it used to call conversions). Go to Admin, Data display, Events, and click the star next to the event once it has appeared. Google's help page on marking events as key events notes that standard properties allow up to 30 key events and that the change applies from the moment you mark it, not retrospectively.
Marking it as a key event matters because it puts affiliate clicks into acquisition and landing page reports as a column, so you can compare traffic sources and pages by the action that actually earns money, not just by sessions.
GA4 reports that show your money pages
Once data is flowing, these are the views that earn their keep on affiliate websites:
Landing pages by affiliate clicks
In Reports, Engagement, Landing page, add the key events column filtered to affiliate_click. Sort by key events, then add a calculated view of key events per session in an exploration. Pages with lots of sessions but few clicks are candidates for better calls to action; pages with a high click rate deserve more internal links pointing at them.
A free-form exploration for program and position
In Explore, create a free-form exploration with rows for Page path and affiliate_program, columns for link_position, and the event count of affiliate_click as the value. This shows, for example, whether comparison table buttons outperform in-text links on your review pages.
Traffic source quality
In Reports, Acquisition, Traffic acquisition, look at session source/medium against affiliate click key events. If you tag campaigns properly with UTM parameters, you can separate newsletter, social and paid traffic and see which actually sends buyers onward.
Connecting GA4 clicks to affiliate earnings
Clicks only become useful when you can put revenue next to them. The practical approach for most publishers:
- Add a sub-ID to every affiliate link that identifies the page (and ideally the position), such as review-page-table.
- Export conversions and commission by sub-ID from each network.
- Join them to GA4 clicks by page in a spreadsheet or a dashboard.
Hypothetical example: a review page sends 1,200 affiliate clicks in a month and the network shows £840 commission against its sub-ID. That page earns £0.70 per affiliate click. A second page sends 3,000 clicks for £900, or £0.30 per click. The second page looks better in GA4; the first is the one worth improving and promoting. Our guide to building an affiliate reporting dashboard covers this join step by step.
Consent, ad blockers and data gaps
GA4 will never show every click. Visitors who decline analytics, use content blockers or browse with strict privacy settings may not be measured at all. If you use Consent Mode, GA4 can model some missing behaviour, but modelled figures are estimates and need enough traffic to kick in. Our explainer on Google Consent Mode v2 covers how that works for publishers.
For trend analysis this is usually fine: you are comparing pages and sources measured the same way. Just do not expect GA4 click totals to match the click counts in your network dashboards, which are measured at the redirect and include visitors GA4 never saw. If GA4 is not a good fit for your audience or your consent setup, compare the options in our guide to Google Analytics alternatives.
Frequently asked questions
Should I use enhanced measurement or a custom affiliate_click event?
Use a custom event if affiliate income matters. Enhanced measurement counts every external link and misses clicks on redirect paths on your own domain. Many sites keep both: enhanced measurement for general outbound behaviour, and a dedicated event for money links.
Why do GA4 clicks not match my network's click numbers?
Networks count clicks at their redirect server, so they include visitors who block or decline analytics, plus some bot traffic. GA4 only records clicks from visitors it can measure. A gap of a meaningful percentage is normal; a sudden change in the gap is what to investigate.
Next steps
Set up the event, register your dimensions and give it a month of data before drawing conclusions. Then pull your clicks and network earnings together so you can rank pages by earnings per click. Browse the rest of our tracking and analytics guides for sub-IDs, postbacks and attribution.