How to Track Outbound Link Clicks in Google Tag Manager
TL;DR: To track outbound link clicks in GTM, create a Click — Just Links trigger where Click URL does not contain your domain, then attach a GA4 Event tag with the event name outbound_click and parameters for link URL and link text. Enable "Wait for Tags" so the hit fires before the browser navigates away. GTM Event Helper can detect outbound links and generate the trigger + tag automatically via the GTM API.
Every outbound link click is a signal. When a visitor leaves your site for an affiliate partner, a documentation page, or a competitor's pricing page, that click tells you something about what they need and whether your site delivered it. Tracking outbound links in Google Tag Manager (GTM) gives you visibility into where your traffic goes after it lands on your pages.
This guide covers everything from GA4's built-in tracking to fully custom setups, including subdomain exclusions, same-tab navigation handling, and the most common mistakes that lead to missing or duplicate data.
What are outbound links and why track them?
An outbound link (also called an external link or exit link) is any hyperlink that points to a different domain than the one the visitor is currently on. If someone is browsing yourdomain.com and clicks a link to partner.com, that's an outbound click.
Why does this matter for analytics? Several reasons:
- Affiliate revenue attribution. If you link to affiliate partners, knowing which links get clicked (and from which pages) directly ties to your revenue tracking. Without outbound click data, you're guessing which placements perform.
- Content effectiveness. Blog posts that reference external tools or resources generate outbound clicks. Tracking which resources your audience clicks tells you what topics resonate and what tools they actually use.
- User journey understanding. A visitor who clicks an outbound link to your documentation site has different intent than one who clicks to a competitor. Outbound click patterns reveal where your site succeeds and where it loses attention.
- Link value for SEO. While outbound click tracking doesn't directly affect rankings, understanding which external links get engagement helps you audit your linking strategy and identify broken or outdated links.
- Partnership reporting. If you send traffic to partners, outbound click data gives you leverage in partnership discussions. Hard numbers beat assumptions.
Without explicit tracking, GA4 shows you pageviews and on-site events but tells you nothing about what happens at the exit point. Outbound click tracking fills that gap.
Does GA4 Enhanced Measurement track outbound clicks automatically?
Yes, partially. GA4's Enhanced Measurement includes an "Outbound clicks" toggle that automatically fires a click event with the parameter outbound: true whenever a user clicks a link pointing to a different domain. This is enabled by default in new GA4 properties.
To check if it's active: go to Admin → Data Streams → your web stream → Enhanced measurement. You should see "Outbound clicks" with a toggle.
When enabled, GA4 automatically collects:
event_name:clicklink_domain: the destination domainlink_url: the full destination URLlink_classes: CSS classes of the clicked elementlink_id: the ID attribute of the clicked elementoutbound:true
For basic outbound click reporting, Enhanced Measurement works out of the box. But it has significant limitations that push most analytics setups toward a custom GTM implementation.
What are the limitations of GA4's built-in outbound click tracking?
Enhanced Measurement's outbound tracking is convenient but inflexible. Here are the specific limitations that matter:
1. No subdomain awareness. GA4 treats subdomains as the same domain by default. Clicks from www.yourdomain.com to blog.yourdomain.com are not counted as outbound. But if you have separate properties or need to track cross-subdomain navigation, you can't configure this within Enhanced Measurement.
2. No link text capture. Enhanced Measurement records link_url, link_domain, link_classes, and link_id but does not capture the visible text of the link. If you have ten links to the same domain on a page, you can't tell which one was clicked based on the default parameters alone.
3. No custom event name. All outbound clicks appear as the generic click event with outbound: true. You can't rename it to something more descriptive like outbound_click or exit_link. This makes GA4 reports harder to filter since the click event may also capture other interactions if you have additional click tracking.
4. No conditional logic. You can't exclude specific external domains (like your own SaaS app domain or a payment provider) from being counted as outbound. It's all or nothing.
5. Limited parameter control. You can't add custom parameters like link_position (header, footer, body) or link_category (affiliate, documentation, social) to the automatically collected event.
6. Conflicts with GTM. If you're already using GTM for other tracking, having Enhanced Measurement fire its own click events alongside your GTM tags creates duplicate data. Google recommends disabling Enhanced Measurement events that you handle through GTM.
For anything beyond basic "how many outbound clicks happened," a custom GTM setup gives you the control you need.
How do I create a custom outbound link trigger in GTM?
The core of outbound link tracking is a trigger that fires only when a user clicks a link pointing outside your domain. Here's the step-by-step setup:
Step 1: Enable Built-In Click Variables
Go to Variables → Configure in your GTM workspace. Under "Clicks," enable:
- Click URL — the
hrefof the clicked link - Click Text — the visible text of the link
- Click Element — the DOM element that received the click
Step 2: Create the Trigger
- Go to Triggers → New
- Choose Click — Just Links (this fires only on
<a>elements) - Check "Wait for Tags" and set the max wait time to 2000 milliseconds (this ensures the GA4 request fires before the browser navigates to the external page)
- Check "Check Validation" to ensure the trigger only fires on valid link clicks
- Set "This trigger fires on" to Some Link Clicks
- Add the condition: Click URL → does not contain →
yourdomain.com
Replace yourdomain.com with your actual domain. This condition means the trigger fires on every link click where the destination URL is not on your domain.
Why "Just Links" and not "All Elements"?
The "Just Links" trigger type offers two features that matter for outbound tracking: "Wait for Tags" and "Check Validation." These options are not available on "All Elements" triggers. "Wait for Tags" is critical because outbound clicks navigate the browser away from your page. Without it, the GA4 request may not complete before the browser unloads the page and starts loading the external URL.
GTM Event Helper detects whether a link points to an external domain during element selection and automatically configures the trigger as "Just Links" with Wait for Tags enabled.
How do I create a GA4 Event tag for outbound links?
With the trigger ready, create the tag that sends the event to GA4:
- Go to Tags → New
- Choose Google Analytics: GA4 Event
- Select your GA4 Configuration tag or enter your Measurement ID directly
- Event Name:
outbound_click - Add event parameters:
link_url→{{Click URL}}link_text→{{Click Text}}
- Set the firing trigger to your outbound link trigger from the previous step
Event Naming: Why Not Just Use "click"?
GA4's Enhanced Measurement uses the generic click event name for outbound clicks. If you use the same name, your custom events merge with auto-collected ones, making reporting confusing. Using a distinct name like outbound_click keeps your data clean and lets you filter specifically for your custom-tracked outbound events.
Remember: GA4 has a 500 distinct event name limit per property and a 40-character limit per event name. outbound_click fits well within both constraints.
How do I capture the destination URL and link text?
The built-in {{Click URL}} variable gives you the full destination URL. The {{Click Text}} variable gives you the visible text inside the <a> tag. But there are situations where these defaults aren't enough.
Extracting the Domain from the URL
If you want to report on outbound clicks by destination domain (e.g., "50 clicks to github.com, 30 clicks to docs.stripe.com"), create a Custom JavaScript variable:
Variable Name: cjs - Link Domain
Type: Custom JavaScript
function() {
var url = {{Click URL}};
if (!url) return '';
try {
return new URL(url).hostname;
} catch(e) {
return '';
}
}
Then add link_domain as an event parameter in your GA4 tag with the value {{cjs - Link Domain}}.
Capturing Link Position
Knowing that someone clicked an outbound link is useful. Knowing they clicked it from the header versus the footer versus the article body is far more actionable. Create another Custom JavaScript variable:
Variable Name: cjs - Link Position
Type: Custom JavaScript
function() {
var el = {{Click Element}};
if (!el) return 'unknown';
if (el.closest('header, nav')) return 'header';
if (el.closest('footer')) return 'footer';
if (el.closest('.sidebar, aside')) return 'sidebar';
if (el.closest('article, .post-content, .article-body')) return 'content';
return 'other';
}
Add link_position as an event parameter. Now your GA4 reports can break down outbound clicks by page position — incredibly useful for understanding which placements drive exits.
Links with Images Instead of Text
When a link wraps an image (common for banner ads or partner logos), {{Click Text}} returns an empty string. To handle this, create a variable that falls back to the image's alt attribute or the URL itself:
Variable Name: cjs - Link Label
Type: Custom JavaScript
function() {
var text = {{Click Text}};
if (text && text.trim()) return text.trim();
var el = {{Click Element}};
if (!el) return {{Click URL}};
var img = el.querySelector('img');
if (img && img.alt) return img.alt;
return el.getAttribute('aria-label') || {{Click URL}};
}
How do I exclude internal subdomains from outbound tracking?
A simple "does not contain yourdomain.com" condition works if you only have one domain. But many businesses use subdomains: app.yourdomain.com, blog.yourdomain.com, docs.yourdomain.com, shop.yourdomain.com. Clicks to these subdomains shouldn't count as outbound.
Option 1: Regex Condition
Change your trigger condition from "does not contain" to "does not match RegEx":
Click URL does not match RegEx (ignore case):
^https?://(www\.|app\.|blog\.|docs\.|shop\.)?yourdomain\.com
This matches any URL that starts with your domain or any of your subdomains. Any URL that doesn't match is treated as outbound.
Option 2: Lookup Table Variable
If you want a more maintainable approach, create a Lookup Table variable that checks the domain:
Variable Name: lu - Is Outbound
Input Variable: {{cjs - Link Domain}}
Lookup Table:
yourdomain.com → false
www.yourdomain.com → false
app.yourdomain.com → false
blog.yourdomain.com → false
docs.yourdomain.com → false
Default Value: true
Then set your trigger condition to: {{lu - Is Outbound}} equals true. This approach is easier to update — adding a new subdomain means adding one row to the lookup table instead of modifying a regex pattern.
What About Cross-Domain Tracking?
If you use GA4 cross-domain tracking (e.g., users move between yourdomain.com and checkout.partnerdomain.com), you probably don't want to count clicks to the partner checkout domain as outbound. Add those domains to your exclusion list using either method above.
How do I track outbound links that open in the same tab?
This is the most common source of missing outbound click data. When a link has target="_blank", the original page stays open and the GA4 request has time to complete. But when a link opens in the same tab (no target attribute or target="_self"), the browser immediately starts navigating away, and the GA4 request may be aborted.
Wait for Tags
The "Wait for Tags" option in the "Just Links" trigger is the primary solution. When enabled, GTM pauses the navigation for the specified time (up to 2000ms) to allow tags to fire. This works for most scenarios, but it has limits:
- It only works for standard
<a>tag clicks. JavaScript-based navigation (window.location.href = '...') bypasses it. - If the GA4 endpoint is slow (server issue, heavy network), even 2000ms may not be enough.
- It adds a slight delay to navigation, which could affect user experience if set too high.
Navigator.sendBeacon Fallback
GA4 uses navigator.sendBeacon() by default for its requests, which is designed to survive page unloads. This means most modern browsers will complete the GA4 request even during navigation. However, sendBeacon isn't guaranteed on all browsers and can fail under heavy memory pressure. "Wait for Tags" adds a safety net on top of sendBeacon.
Transport URL Setting
In your GA4 Configuration tag, make sure the "Send to server container" or transport mechanism is set correctly. If you're using server-side GTM, the request goes to your own server first, which is typically faster than Google's collection endpoint and reduces the risk of lost hits during page transitions.
How do I analyze outbound link data in GA4?
Once your outbound click tracking is live and collecting data, here's how to turn it into actionable insights.
Standard Reports
Go to Reports → Engagement → Events and find your outbound_click event. Click it to see the event count over time. To see the breakdown by destination URL or link text, you need to register your custom parameters as custom dimensions first.
Register Custom Dimensions
Go to Admin → Custom definitions → Create custom dimension:
- Dimension name:
Link URL, Event parameter:link_url, Scope: Event - Dimension name:
Link Text, Event parameter:link_text, Scope: Event - Dimension name:
Link Domain, Event parameter:link_domain, Scope: Event - Dimension name:
Link Position, Event parameter:link_position, Scope: Event
GA4 allows up to 50 event-scoped custom dimensions, so this won't eat significantly into your quota.
Exploration Reports
For deeper analysis, use Explore → Free form:
- Rows: Link Domain, Link URL, Link Text
- Values: Event count, Total users
- Filter: Event name = outbound_click
This shows you exactly which external links get clicked, how often, and by how many unique users. Sort by event count to find your most-clicked outbound destinations.
Page-Level Analysis
Add Page path as a secondary dimension to see which of your pages generate the most outbound clicks. High outbound click rates on landing pages might indicate that visitors aren't finding what they need, while high outbound clicks on resource pages is expected and healthy behavior.
What are common outbound link tracking mistakes?
These are the issues that cause missing, duplicate, or inaccurate outbound link data. Avoiding them saves hours of debugging.
1. Not enabling "Wait for Tags." This is the number one cause of missing outbound click data. Without it, same-tab outbound links navigate away before the GA4 request completes. Always enable it on "Just Links" triggers for outbound tracking, with a 2000ms max wait time.
2. Using "All Elements" instead of "Just Links." The "All Elements" trigger type doesn't support "Wait for Tags." If you use it for outbound link tracking, same-tab clicks will be lost. Use "Just Links" for any link-based tracking where navigation is involved.
3. Not disabling Enhanced Measurement outbound clicks. If you have a custom GTM setup and Enhanced Measurement is still tracking outbound clicks, you'll get duplicate events. Go to your GA4 data stream settings and disable the "Outbound clicks" toggle under Enhanced Measurement when using a custom GTM implementation.
4. Treating subdomains as outbound. A "does not contain" condition with just the root domain usually handles subdomains. But if you have a separate domain for your app (e.g., app.differentdomain.com), you need to explicitly exclude it in your trigger conditions.
5. Not registering custom dimensions. You send link_url and link_text as event parameters, but they don't appear in GA4 reports until you register them as custom dimensions. This is the most common "I set everything up but can't see the data" issue.
6. Forgetting mailto: and tel: links. Links with mailto: or tel: protocols aren't outbound links, but they also don't contain your domain name. Your trigger will fire on them unless you add a condition: Click URL → starts with → http. This ensures only actual web URLs trigger the event.
7. Ignoring JavaScript-driven navigation. Some sites use JavaScript to handle link clicks (window.open(), window.location.href, or SPA routing). Standard click triggers won't catch these. You'll need a Custom HTML tag with event listeners or a Custom Event trigger if the site pushes events to the dataLayer.
Is there a faster way to track outbound links?
The manual setup above involves enabling variables, creating triggers, building tags, configuring conditions, and testing in Tag Assistant. For a single outbound link setup, that's manageable. But if you need to track outbound links across multiple pages with different exclusion rules, or add link position tracking, the manual approach gets tedious fast.
GTM Event Helper simplifies this workflow:
- Click any link on your page
- The extension detects whether it's outbound and shows the destination domain
- Choose your event name and parameters
- Click "Create in GTM" — the trigger (with Wait for Tags), GA4 tag, and all parameters are created via the GTM API in one step
No manual variable configuration. No switching between tabs. No forgetting "Wait for Tags." The extension handles the entire workflow from element selection to published tag.
Track every outbound click without the manual GTM setup.
Install GTM Event HelperExternal Resources
- GA4: Enhanced Measurement events
- Google: Set up click triggers in GTM
- GA4: Custom dimensions and metrics
- MDN: Navigator.sendBeacon()