How to Set Up Google Analytics for Affiliate Marketing

How to Set Up Google Analytics for Affiliate Marketing
Linkgaze Team 12 min read

Can Google Analytics Actually Track Your Affiliate Links?

Google Analytics is free, powerful, and already installed on most websites. If you're an affiliate marketer, it makes sense to ask: can GA4 handle my affiliate link tracking?

The short answer: yes, but with some important caveats. Google Analytics 4 can track clicks on affiliate links, measure traffic by source, and help you understand which content drives the most engagement. What it can't do is directly connect those clicks to your affiliate revenue — that data lives in your affiliate network dashboards.

This guide walks you through setting up GA4 specifically for affiliate marketing: from creating your property to tracking outbound link clicks, tagging your affiliate links with UTM parameters, and building reports that actually help you make decisions.

By the end, you'll have a working GA4 setup that tells you where your affiliate clicks come from, which content converts best, and where to focus your time.

What Google Analytics Can (and Can't) Do for Affiliate Marketing

Before we dive into setup, let's be honest about what GA4 is good at — and where it falls short for affiliate marketers.

What GA4 Does Well

Where GA4 Falls Short for Affiliates

⚠️ Important to understand: Google Analytics tracks what happens on your website. It cannot track clicks on links you share on social media, email, YouTube, or anywhere off-site. For multi-platform affiliate tracking, you'll need to either pair GA4 with a dedicated link tracker or use UTM parameters consistently across every platform.

Step 1: Create Your Google Analytics 4 Property

If you don't already have GA4 set up, here's how to get started.

  1. Go to analytics.google.com and sign in with your Google account.
  2. Click "Start measuring" if this is your first time, or click the admin gear icon → "Create property" if you already have an account.
  3. Enter a property name. Use your website name or your brand (e.g., "Tech Review Blog").
  4. Set your reporting time zone and currency. This affects how data displays in reports.
  5. Fill in business details (category, size). This is optional but helps GA4 tailor recommendations.
  6. Select business objectives. Choose "Generate leads" or "Examine user behavior" — these enable relevant default reports.
  7. Create a data stream. Choose "Web" and enter your website URL and a stream name (e.g., "Main Website").

After creating the data stream, GA4 will show you a Measurement ID (starts with "G-"). You'll need this to connect your website to GA4.

Step 2: Install the Tracking Code on Your Website

How you install GA4 depends on your platform:

WordPress

The easiest option is a plugin:

Install your chosen plugin, enter your GA4 Measurement ID, and you're done. No code editing required.

Custom HTML Website

Add the GA4 tracking code to every page of your site. Paste this in the <head> section, replacing G-XXXXXXXXXX with your Measurement ID:

<script async src="https://www.googletagmanager.com/gtag/js?id=G-XXXXXXXXXX"></script>
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());
  gtag('config', 'G-XXXXXXXXXX');
</script>

Shopify, Wix, Squarespace

Each platform has a dedicated GA4 integration in their settings. Search for "Google Analytics" in your site's admin panel and follow the prompts to connect your Measurement ID.

Verify Installation

Wait a few minutes, then go to GA4 → Reports → Realtime. Visit your website in another tab. You should see yourself appear as an active user in real time. If you do, tracking is working.

Step 3: Enable Enhanced Measurement

This is the step that makes GA4 actually useful for affiliate marketing. Enhanced Measurement automatically tracks several events — including outbound link clicks — without requiring any custom code.

  1. In GA4, go to Admin (gear icon, bottom left)
  2. Under "Data collection and modification," click Data streams
  3. Click your website data stream
  4. Toggle Enhanced measurement on (it's usually on by default)
  5. Click the gear icon next to it to see what's being tracked

Enhanced Measurement tracks these events automatically:

Event What it tracks Useful for affiliates?
page_view Every page load ✅ Baseline traffic measurement
scroll When users scroll 90% of the page ✅ Engagement indicator for long posts
click (outbound) Clicks on links to other domains ✅✅ This is affiliate link tracking!
view_search_results Internal site searches Limited
video_start, video_progress YouTube video engagement (embedded videos) Limited
file_download PDF, ZIP, and other file downloads Limited

The outbound click event is the one we care about. Every time a visitor clicks a link on your site that goes to a different domain — including affiliate links to Amazon, ShareASale, or any merchant — GA4 records it.

Step 4: Verify Affiliate Link Clicks Are Being Tracked

Let's make sure your affiliate link clicks actually show up in GA4.

  1. Visit your website and click one of your affiliate links (it's okay — you can close the tab immediately)
  2. In GA4, go to Reports → Realtime
  3. Scroll down to the "Event count by Event name" card
  4. Look for a click event

You should see the click event with a count of 1 (or more, if other visitors have clicked too). Click on the event name to drill in and see which link was clicked — you'll see URLs under the link_url parameter.

💡 Pro Tip: If you don't see the click event, check that the link opens a different domain (not just a different page on your site). Outbound tracking only fires when the destination is a different domain. Also verify you're not running an ad blocker, which can block GA4 events.

Step 5: Tag Your Affiliate Links with UTM Parameters

Enhanced measurement captures that someone clicked, but for off-site sharing (YouTube, email, social), you need UTM parameters to track where your traffic came from.

Add UTM parameters to every link you share outside your website. A tagged link looks like this:

https://yourblog.com/best-headphones?utm_source=youtube&utm_medium=video&utm_campaign=headphones-review

The 3 UTM Parameters You Actually Need

Parameter Purpose Example values
utm_source Where the link was shared youtube, instagram, email, twitter, pinterest
utm_medium The type of channel video, social, newsletter, story, bio
utm_campaign The specific content or campaign headphones-review, q2-launch, welcome-sequence

For a detailed breakdown of UTM parameters, naming conventions, and common mistakes, see our complete UTM parameters guide.

Use Google's Campaign URL Builder

Instead of building UTM links by hand, use Google's free Campaign URL Builder at ga-dev-tools.google/campaign-url-builder/. Enter your URL and UTM values, and it generates the tagged link for you. No typos, no mistakes.

Step 6: Build Reports That Actually Help You

GA4's default reports are too generic for affiliate marketing. Here are the custom reports worth building.

Report 1: Traffic by UTM Source/Medium

This shows you which platforms send traffic to your website.

  1. Go to Reports → Acquisition → Traffic acquisition
  2. By default, you'll see traffic grouped by channel. Change the primary dimension to Session source / medium using the dropdown above the table
  3. You'll now see traffic broken down by your UTM-tagged sources

This tells you if your YouTube → blog traffic is actually landing, and how much of it. Combine it with click data to calculate downstream affiliate performance.

Report 2: Outbound Clicks by Destination

This is the most important report for affiliate marketers. It shows which affiliate links are getting clicked on your website.

  1. Go to Reports → Engagement → Events
  2. Click the click event in the list
  3. Scroll down to see "Event parameters" — look for link_url and link_domain
  4. You can filter or segment by domain to see just Amazon clicks, just ShareASale clicks, etc.

To make this a regular report you can revisit, consider creating a custom Exploration (more on that below).

Report 3: Top Pages Driving Affiliate Clicks

Which of your blog posts actually get affiliate clicks? This report answers that.

  1. Go to Explore in the left sidebar
  2. Click "Blank" to create a new exploration
  3. In the Dimensions panel, add Page path and screen class and Event name
  4. In the Metrics panel, add Event count
  5. Drag "Page path" to Rows and "Event count" to Values
  6. In the Filters section, add a filter: Event name exactly matches click

You'll now see a table showing each page on your site and how many outbound clicks it generated. This is gold — it tells you which blog posts are actually sending traffic to affiliate products.

💡 Pro Tip: Sort this report by Event count descending. The top 10 pages in this list are your affiliate revenue drivers (or at least, your click drivers). Focus your updates, promotion, and internal linking on these pages.

Report 4: Conversion Funnel by UTM Source

This is advanced but valuable: see how visitors from different sources behave differently.

  1. Create a new exploration (Explore → Funnel exploration)
  2. Define steps: Step 1 = page_view (landing page), Step 2 = scroll (90% of page), Step 3 = click (outbound)
  3. Break down by "Session source / medium"

You'll see drop-off rates at each step, segmented by where the visitor came from. Visitors from YouTube might drop off at Step 2 (they don't scroll), while visitors from your email list click through at 3x the rate. That's actionable data.

Step 7: Mark Affiliate Link Clicks as Key Events (Conversions)

GA4 lets you mark certain events as "key events" (formerly called "conversions"). This is useful because key events get prioritized in reports and can be used in attribution modeling.

To mark outbound clicks as a key event:

  1. Go to Admin → Events
  2. Find the click event in the list
  3. Toggle Mark as key event on

Now GA4 will treat affiliate clicks as conversions. You'll see them in conversion reports, and you can use them in the Attribution section to see which channels drive the most affiliate clicks.

⚠️ Caveat: This marks all outbound clicks as conversions, not just affiliate clicks. If you link to non-affiliate external sites (sources, citations, etc.), those will also count. For more precise tracking, you'd need to set up a custom event that only fires on affiliate domains — which requires Google Tag Manager or custom code.

Advanced: Track Only Affiliate Link Clicks (Not All Outbound)

If you want cleaner data, you can create a custom event that fires only when someone clicks an affiliate link (based on the destination domain). This requires Google Tag Manager (GTM).

Quick Setup with Google Tag Manager

  1. Set up GTM at tagmanager.google.com and install the container code on your site
  2. Create a new trigger: Trigger Type = "Click - Just Links," fire on "Some Link Clicks," condition = "Click URL contains amazon.com" (or your affiliate domain)
  3. Create a new tag: Tag Type = "Google Analytics: GA4 Event," Event Name = affiliate_click, add parameters for link_url and product
  4. Attach the trigger you created
  5. Publish the container

Now GA4 will record a dedicated affiliate_click event every time someone clicks an Amazon link. Repeat for each affiliate network (ShareASale, Impact, etc.) with additional triggers.

This approach gives you clean data specifically about affiliate clicks — separate from general outbound link clicks — but it's significantly more setup than using Enhanced Measurement alone.

Step 8: Connect the Data to Revenue

Here's where GA4 hits its fundamental limit. Google Analytics can tell you:

But GA4 cannot tell you how many of those clicks resulted in a sale. That data lives in Amazon Associates, ShareASale, Impact, and your other affiliate dashboards.

To connect the two, you need to do manual revenue mapping:

  1. Each week, export outbound click data from GA4 (which products got clicked, how many times, from which sources)
  2. Export sales data from your affiliate dashboards (which products sold, how much revenue)
  3. Match them in a spreadsheet to calculate revenue per click (RPC) by product and source

For a detailed walkthrough of this process, see our guide on how to know which affiliate links actually make you money.

Common Problems and How to Fix Them

Problem: "I Don't See Any Click Events in GA4"

Possible causes:

Problem: "My UTM Traffic Shows as 'Direct' or '(not set)'"

This usually means the UTM parameters were stripped before GA4 saw them:

Problem: "GA4 Numbers Don't Match My Affiliate Dashboard"

They never will, and that's normal. Here's why:

Use GA4 for click-level insights and your affiliate dashboards for revenue truth. Don't expect the numbers to match exactly.

When GA4 Is Enough — and When You Need More

Honest advice: Google Analytics is great for understanding behavior on your own website, but it has real limitations for affiliate marketing specifically.

GA4 Is Enough If:

You'll Want Something More If:

For creators who primarily promote on platforms other than their blog, GA4 alone leaves big gaps. A dedicated affiliate link tracker fills those gaps by tracking clicks at the link level, regardless of where the link was shared.

💡 The best setup: Use GA4 for on-site behavior (which blog posts drive clicks, how visitors navigate your site) and a dedicated affiliate link tracker for off-site click tracking (which platform sent each click, device/location data). Together, they cover both sides of the tracking problem.

GA4 vs. Dedicated Affiliate Trackers: Quick Comparison

Feature Google Analytics 4 Affiliate Link Tracker
Cost Free Free tier to $29/mo
Tracks on-site behavior ✅ Excellent
Tracks off-site clicks (YouTube, email, social)
Automatic source tagging ❌ Manual UTMs required ✅ Automatic
Per-link analytics ✅ With setup ✅ Out of the box
Setup complexity Medium-High Low
Connects to affiliate revenue ❌ Manual mapping ❌ Manual mapping
Privacy/ad blocker resistance Moderate High (server-side)

Neither tool replaces your affiliate dashboard for revenue data. The question is which one helps you understand what's driving that revenue.

5 GA4 Settings Every Affiliate Marketer Should Enable

  1. Enhanced Measurement. Turns on outbound click tracking without code. Critical for affiliates.
  2. Data retention: 14 months. Default is 2 months. Change to 14 months under Admin → Data Settings → Data Retention so you can analyze year-over-year trends.
  3. Google Signals. Enables cross-device tracking for signed-in Google users. Under Admin → Data collection.
  4. Exclude internal traffic. Filter out your own visits so your browsing doesn't skew data. Admin → Data streams → Configure tag settings → Define internal traffic.
  5. Referral exclusion list. Add your own domain and any domains that shouldn't count as referrals (like payment processors). Admin → Data streams → Configure tag settings → List unwanted referrals.

The Bottom Line

Google Analytics 4 is a capable tool for affiliate marketers — especially if your traffic lives on your own website. With Enhanced Measurement enabled, you can track outbound clicks, see which pages drive the most affiliate engagement, and segment traffic by UTM source.

But GA4 has two fundamental limitations: it can't track clicks that happen outside your website (social media, email, YouTube), and it can't directly connect clicks to affiliate revenue. To get the full picture, you'll need to pair GA4 with either manual UTM discipline or a dedicated affiliate link tracker.

Here's a smart approach:

  1. Set up GA4 with Enhanced Measurement for on-site click tracking
  2. Tag all off-site links (YouTube, email, social) with UTM parameters
  3. Build custom reports to see outbound clicks by page and source
  4. Manually map GA4 click data to affiliate dashboard revenue weekly
  5. Consider adding a dedicated link tracker for off-site click visibility

The creators who get the most out of GA4 aren't the ones who use every feature — they're the ones who focus on two things: which pages drive affiliate clicks and which sources send the best traffic. Start there, and let the data guide your next moves.

For a broader look at tracking methods, see our complete guide to tracking affiliate links in 2026. To understand UTM parameters in depth, check out our UTM parameters guide.

Want Simpler Affiliate Tracking Than GA4?

Linkgaze gives you per-platform click data, automatic UTM tagging, and revenue-focused analytics — without the complexity of setting up events, custom reports, and filters in Google Analytics.

  • No events or custom reports to configure
  • Automatic source detection across every platform
  • Built specifically for affiliate marketers
Try Linkgaze Free