Track Affiliate Link Clicks in GA4: Direct Links vs WordPress Redirects

Introduction

Tracking affiliate link clicks in GA4 helps you understand which articles encourage readers to explore your recommendations. Traffic alone does not reveal whether visitors take that next step. Reliable click data gives you a clearer foundation for improving content and evaluating affiliate performance.

However, direct affiliate links and WordPress redirects need different tracking approaches. A link pointing to another domain can trigger automatic outbound measurement, while a branded link using your own domain may not. This guide explains both setups, how redirect plugins fit in, and how to verify your events before relying on the reports.


What GA4 Tracks Automatically

GA4’s enhanced measurement can record an event named click when someone follows a link away from your domain. According to Google’s enhanced measurement documentation, the event includes link_url, link_domain, link_classes, link_id, and the boolean parameter outbound.

✅ link_url identifies the clicked destination URL.
✅ link_domain identifies its domain.
✅ outbound indicates an outbound interaction.

These parameters describe the link clicked on your page, not necessarily the final merchant reached after subsequent redirects. Links to domains configured for cross-domain measurement are excluded from automatic outbound events. Also, outbound tracking includes ordinary external references—not just affiliate recommendations.


How to Track Direct Affiliate Links

1. Confirm Your Existing Installation
Check that your Google tag sends data to the correct GA4 web stream. Identify whether a WordPress plugin, theme integration, or Google Tag Manager manages it. Avoid installing a second copy simply to enable click tracking.

2. Enable Outbound Click Measurement
In GA4, open Admin → Data collection and modification → Data streams, select your web stream, and open the enhanced measurement settings. Enable Outbound clicks. With the Google tag installed and automatic detection enabled, no additional click-tracking code is required for standard external links.

3. Identify Affiliate Destinations
Use the Link URL and Link domain dimensions to separate known affiliate destinations from other external links. Filter carefully when an affiliate network and ordinary references share a domain. For broader context, our guide to affiliate marketing explains tracking links and commission models.


Why WordPress Redirects Need a Different Approach

A branded link such as https://example.com/go/example-offer/ initially points to the same domain as the article. Automatic outbound measurement does not treat that initial click as an external destination merely because the server later redirects the visitor elsewhere.

Plugins may record their own clicks without sending any corresponding GA4 event. Pretty Links’ documentation also explains that its head scripts run only on redirect types that render a page. Plain 301, 302, and 307 redirects do not render a page for those scripts to execute.

Track the interaction on the article page before navigation rather than changing redirect types just to run analytics. Always check your affiliate program’s rules before using cloaking or redirects.

Hand selecting a glowing link symbol before navigation

Set Up a Custom Affiliate Click Event in GTM

1. Prepare Your Variables
With GTM installed and your Google tag configured, open Variables → Configure and enable Click URL and Click Text. Use your GA4 Measurement ID beginning G-, not the GTM container ID.

2. Create a Focused Trigger
Create a Click → Just Links trigger. Choose Some Link Clicks and match your affiliate redirect URLs. For the fictional example above, use Click URL begins with https://example.com/go/. Replace this with your real domain and prefix; account for any alternate hostnames actually used.

Google’s click-trigger guide describes optional Wait for Tags and Check Validation settings. Test their behavior with your links rather than assuming every navigation works identically.

3. Create the GA4 Event Tag
Add a Google Analytics: GA4 Event tag for your Measurement ID. Name the event affiliate_click, add link_url with value {{Click URL}}, and attach your trigger. This captures the branded URL—not the hidden merchant destination. Google’s event setup instructions explain the tag-and-trigger workflow.


Using ThirstyAffiliates Instead

ThirstyAffiliates Pro offers a separate, documented GTM integration. Its Google Click Tracking module must be enabled, and Tracking Script set to Google Tag Manager. Selecting that option alone does not finish the setup.

The official ThirstyAffiliates instructions use a data-layer event named Affiliate Link by default and a field named link_uri. Create a Data Layer Variable for that field, a Custom Event trigger matching the exact event name, and a GA4 Event tag. Their example sends affiliate_link with a link_uri parameter.

The plugin’s GTM event name and GA4 event name are different settings. The trigger listens for Affiliate Link, while the tag sends the Analytics-friendly name affiliate_link. Do not copy the spaced trigger name into the GA4 event-name field. Match the documentation to your selected settings, including capitalization.

Choose this integration or the generic click trigger for the same links—not both. Clear affected caches after changing plugin tracking settings. Check your installed edition and settings; not every plain link is a plugin-managed link.


Verify Events and Read the Results

Use GTM Preview and Tag Assistant to test a normal click. Confirm the intended tag fires once and carries the correct URL. With debug mode enabled, inspect the event in GA4 DebugView. Check both direct and redirected links, plus an ordinary internal link that should not trigger your affiliate event.

Keep a simple tracking plan before expanding the setup. Record the link format, event name, trigger condition, and reporting parameter for each method. This helps prevent a future plugin change from silently breaking your reports. If you rename a custom event, document the change so comparisons across reporting periods remain meaningful.

For automatic events, build an exploration using Event count, Link URL, and Link domain, filtered to click and your affiliate destinations. For custom tracking, filter to your chosen event name. Register plugin-specific parameters such as link_uri as event-scoped custom dimensions for reporting; allow 24–48 hours after registration.

Magnifying glass highlighting a link symbol above a laptop

Common Tracking Mistakes to Avoid

🚫 Double-counting clicks – Do not add automatic click and custom-event totals together for the same interactions.
🚫 Confusing clicks with revenue – Merchant sales and approved commissions require affiliate-network reporting.
🚫 Ignoring privacy – Respect consent requirements and never send personal information in URLs or parameters.

Remember that click tracking measures interest, not an automatic improvement in search rankings. A page with fewer clicks may answer an informational question successfully. Compare pages with similar purposes before moving buttons or rewriting introductions, and judge affiliate performance using approved commissions as well as engagement.

Consent choices, browser restrictions, blockers, and different counting rules can create gaps between GA4 and plugin reports. Investigate differences rather than expecting identical totals. Use these insights alongside your keyword strategy and Pinterest affiliate marketing efforts to assess what happens after visitors arrive.


Final Thoughts

Reliable affiliate click tracking starts with understanding your links. Use enhanced measurement for eligible direct outbound links and a tested custom setup for same-domain redirects.

By keeping events consistent, checking parameters, and comparing clicks with confirmed commissions, you can make more informed content decisions. Start with a small set of links, verify the setup, and expand once the data is trustworthy.

cropped-cropped-Click-Catchers-Logo-WB-T.png

About the author

An expert in affiliate and digital marketing, the founder of Click Catchers has helped brands grow through performance-based strategies and data-driven solutions. With experience in SEO, content marketing, and conversion optimization, he specializes in connecting businesses with engaged audiences to drive measurable success.