
How do I track affiliate link clicks in Google Analytics 4?
A step-by-step guide
The tracking of external links (outbound links) is integrated in Google Analytics 4. The corresponding event is called"click" - this is triggered for all outbound links. If you only want to see the actual affiliate links in a report, you need to set up a special event with the corresponding parameters. This is possible both directly in the GA4 property and via the Google Tag Manager. The second option is more flexible and can be used if many unique affiliate domains are in use. If one or two domains are involved, it is sufficient to set this up directly in the configuration of the GA4 property.
The most important facts in brief:
Activate outbound-link tracking – GA4 tracks clicks on external links by default.
Capture affiliate clicks separately – create a custom event (e.g. “affiliate_link_click”) for affiliate domains.
Two setup options – use built-in GA4 for a few domains, or Google Tag Manager for many.
Trigger & tag events – in GTM define a click trigger with regex for domains and send event with URL parameter.
Test via DebugView – verify event fires with correct URL in GA4’s DebugView.
Build GA4 report – after 24 h, explore event counts, link URLs, and page paths.
Goal: Track affiliate link clicks and display them in the GA4 report
In this article, we look at examples of (fictitious) affiliate links from amazon.de and otto.de - the aim of the report is to see how often these links are clicked on by website visitors, which URL it is exactly and on which of our subpages the clicks occur.
Preparatory measures
First of all, check whether the "Outbound clicks" option is activated for the web stream in the Optimized analyses section. The option is activated when the GA4 property is first set up. If this is not the case, you can simply activate it!
The way to the setting: Administration > Data streams > "Your stream name" > Events [Optimized analyses] > Click on gear > "Click on external links".
Option 1 - User-defined event in the GA4 property
This method is well suited if only a few different affiliate partners are linked on the website. If there are many different affiliate domains, tracking should be controlled via the Google Tag Manager, see option 2.
- event_name IS EQUAL click
- link_url INCLUDES amazon.com

- Testing: You can test whether the event is triggered as desired in the DebugView of GA4 (Configure > DebugView) - In addition, the Chrome Extension Google Analytics Debugger must be installed and activated so that the correct debug signals are sent to the DebugView.
- The event "affiliate_link_click" should now appear in the DebugView when clicking on the affiliate link. By clicking on the event, you will find the passed parameter "link_url", which contains the affiliate URL as a value. If this is the case, everything is set up correctly and you can access this event via your reports after approx. 24 hours in order to evaluate it. To track the second affiliate link otto.de, simply repeat steps 1-5. The event name should be exactly the same. Only "amazon.de" should be replaced by "otto.de" in the matching conditions.
Tip: You can copy existing events. To do this, open one of the events and click on COPY in the three-dot menu at the top right.
How to use the event in the evaluation is explained below.

Option 2 - Implement GA4-Afilliate Link Tracking via Google Tag Manager
The prerequisite is, of course, that the tag manager is implemented correctly.
- Check whether click variables are activated. For the example case, only the click URL is initially required. However, all others will also be useful sooner or later, which is why you can activate them all.
- Variables > Configure > Select all variables in the "Clicks" area
- Create a new trigger with the name "Affiliate Link Click" (1), for example:
- Trigger > New > "Links only" > "Some clicks on links" (2, 3)
- Click URL MEMBERS WITH THE REGEX amazon.com|otto.com (4)
- Save
All domains used in the affiliate links can now be listed and separated using the pipe |. In the example above, the trigger fires when a user clicks on a link that contains "amazon.de" or "otto.de" in the URL. This allows you to address five or 25 domains whose click triggers this trigger. Now the new event "affiliate_link_click" just needs to be forwarded to Google Analytics 4. This is done with the tag.

- Create a new tag with the name (e.g.) "GA4 event - affiliate_link_click"
- Select "GA4 event" as the tag type
- Select the correct cofiguration tag in the dropdown
- Specify "affiliate_link_click" as the event name
- Add event parameter > line
- Parameter name: link_url
- Value: {{Click URL}}
- Assign trigger: "Affiliate Link Click" (as created above)
- Save
- Test! Use the preview mode of the tag manager. Is the tag "GA4 event - affiliate_link_click" fired when clicking on the affiliate links? Does the new event "affiliate_link_click" appear in the GA4 DebugView and does it have the correct URL as a parameter? Then everything is set up correctly and the new features in the tag manager can be published.

Affiliate link clicks in the Google Analytics 4 report
After the setup, whether using option 1 or 2, and the successful tests, you have to wait 24 hours. Only then will the new event be available in the reports. The next day, create a new report in the "Explore" area and select the following dimensions and measured values:
- Dimensions: Import link URL, page path and screen class and insert into the "Rows" area by double-clicking
- Measured values: Double-click to place the number of events in the "Values" area
All events are now displayed. The new event "affiliate_link_click" must therefore be set as the final action at the bottom of the filter.
- Event name MEMBERS EXACTLY affiliate_link_click
This completes the report and provides the number of clicks on the affiliate links, their URLs and the URL of your own website on which the affiliate link was clicked for the selected time period.

We take over!
GTM, Google Analytics 4, events, parameters, DebugView - it's easy to lose track. As an SEO agency and Google Premium Partner, we are happy to support you with the setup, configuration and tracking extension as well as the creation of corresponding reports in GA4 or Google Looker Studio.