Last Modified on October 23, 2024
Ready to explore the world of affiliate data in GA4?
So you have included affiliate links in your website. You wanted to track and analyze them effectively, so you installed Google Analytics 4. With this analytics tool, you can collect and analyze data – where your website visitors come from and their behavior on your website.
In this tutorial, you’ll learn how to create a partner click event and how to leverage it to track affiliate links with GA4. Take your affiliate game to the next level by measuring partner click conversions.
Here is an overview of what we’ll cover:
- Affiliate Data in GA4
- Track Affiliate Links with GA4
- Create a Partner Click Event
- Create Partner Click Conversions
Let’s dive in!
Affiliate Data in GA4
To start, we have come up with a review about this “beard bib” on our website. Part of our review is a link to our affiliate website that users can click and buy the product directly.
Below is our affiliate link that directs users to the Amazon product page.
We will discuss how to track affiliate links with GA4, so ensure you have installed this tool on your website correctly before proceeding.
🚨 Note: Check out our Google Analytics 4 Tutorial for Beginners to learn how to set up GA4 and some of the basics to get you started.
With GA4 set up on your website, you can get some interesting data about your users. You can also go to Reports → Real-time to see where your users come from.
Real-time reports let you monitor user activity on your website or app as it happens. There are also cards for how users enter the conversion funnel and how they behave in the funnel.
🚨 Note: Check out our guide on the 10 Reports in Google Analytics 4 to Measure SEO Performance for more information on all standard report types.
What we’re interested in for this guide is the Traffic acquisition report.
Here, we want to know how many users come from Organic Search.
If we scroll to the end of the table, we will see how many Conversions we have for each session default channel group.
This report is from the GA4 demo account, so it doesn’t show the data from our website.
If we go to the same report on the Google Analytics account connected to our website, we’ll see that we don’t have any conversion data.
So, how can we track affiliate links with GA4 and fill this column out?
Track Affiliate Links with GA4
With affiliate sales, we want the user to click one of our partner links. The great thing with GA4 is that it can track these links automatically with one simple step.
All we need to do is go to our data stream settings and enable Enhanced measurement events. Next, click on the gear icon to check which events we enabled.
Enhanced measurement is Google’s way of giving additional data to just the page view data without any code changes. The event options include scrolls, outbound link clicks, site searches, video engagements, file downloads, and form interactions.
We are most interested in Outbound clicks since we want to track affiliate links with GA4. Toggle this option to enable.
Since we are clicking on a website link that is outbound to our website, in other words, doesn’t include our domain in the URL, this option is perfect for our needs.
Next, let’s go to the Admin section and click DebugView.
The GA4 DebugView is a handy feature that lets you monitor events on your site in real time. It is primarily for troubleshooting your analytics implementations.
There are some prerequisites before we can see this function in your GA4 account. One way is to install and enable the Google Analytics Debugger Chrome extension.
This method is quick and easy and only requires using Google Chrome as your browser.
🚨 Note: Check out these Top 10 Chrome Extensions for Digital Marketers for the most helpful tools to aid your marketing needs.
If we click on one of the events in the timeline in the middle, we’ll see more details, like the event parameters.
For example, the page_view event has the GA session number, page location, page title, etc.
After clicking on one of our affiliate links on our website, we should see a new click event in the DebugView.
Sometimes, it may take a bit before we see the event showing. One reason could be because of occasional event groupings before showing up in GA4. It shouldn’t take more than a few seconds.
This click event will resemble all outbound link clicks on our website. We can look at data like the link domain, the exact link URL it redirects to, and more.
While this is a great starting point, this event is not specific to our partner link that redirects to the Amazon product page. This event triggers during any and every outbound link click.
For example, we have this link going to WooCommerce.
Clicking on this link will trigger another outbound link click.
Since we need to track affiliate links with GA4, we cannot use this general click event as a conversion. We must find a way to differentiate partner link clicks from other outbound link clicks.
🚨 Note: Check out our guide on How to Track Button Clicks in GA4 for an in-depth guide on tracking click events.
Create a Partner Click Event
Within the admin section still, let’s go to the Events section.
Here, we have the events that we are tracking on our website. We have click, page view, scroll, and select item events.
We can mark specific events as a conversion here.
Again, we don’t want to mark all click events as a conversion since this makes all outbound links count as a conversion. We only want to track affiliate sales from partner link clicks.
What we can do here is create a new event out of the general click event. Click Create Event.
Next, click Create.
First, let’s provide a name for this new event. We’ll name this partner_click.
You’ll notice we used the snake_case naming convention, which Google Analytics uses. All letters are in lowercase, and we replaced spaces with an underscore. We’ll adhere to this convention here on in, and recommend you follow this for future events, as well.
Next, we’ll specify the matching conditions for our new event.
The first will grab the general click event: event_name equals click. Next, click Add condition.
For the second condition, we need to specify that we only want the click events for links to our affiliate partners.
🚨 Note: When we specify more than one matching condition, the custom event must match all of the conditions.
You may not see the link URL in the parameters list since this only shows common/standard parameters. Don’t worry, since we can type this out.
Set the condition to: link_url contains amazon.com.
Finally, check the option to Copy parameters from the source event.
Great! Those are the only settings we need to create our new event. Now, we have a specific event to track affiliate links with GA4.
Let’s test out this custom event. Let’s go back to our page and click our partner link to Amazon.
When we go to DebugView, we should see two events simultaneously triggered: click and partner_click.
If we click on the WooCommerce link, which is not an affiliate link, we only get the click event and not the partner click event.
All that’s left to track affiliate links with GA4 is to mark our custom event as a conversion.
Create Partner Click Conversions
It may take a while to see custom events in the events section.
Once available, toggle the option to mark our partner_click event as a conversion.
Another option, though we do not recommend it, is to go to the Conversions section.
Next, click New Conversion Event.
Enter the exact event name, then click Save.
Our custom partner click event is now a conversion.
When we go to our page again and click another partner link, the partner_click event now has a green flag icon.
How do you view this data in your reports?
Once the data comes, click on our event in the conversions section.
Here, we can see a report that shows how many affiliate link clicks we tracked in a given period. Unfortunately, this takes a while to populate, so our account doesn’t have this yet.
Another place to see this data is the traffic acquisition report. In the conversions column, we can select the partner click event so it only shows data for this specific conversion.
Summary
How to Track Affiliate Links with GA4 (Steps Summarized)
- Ensure GA4 is Installed:
- Verify that GA4 is correctly set up on your website.
- Enable Enhanced Measurement:
- Go to your data stream settings.
- Enable Enhanced measurement events.
- Click on the gear icon to check the events.
- Ensure that the Outbound clicks option is enabled.
- Verify Outbound Clicks in DebugView:
- Go to the Admin section and click DebugView.
- Install and enable the Google Analytics Debugger Chrome extension if necessary.
- Click an affiliate link on your website and check for a new click event in DebugView.
- Create a Partner Click Event:
- Go to the Events section in the Admin settings.
- Click Create Event.
- Provide a name for the new event (e.g., partner_click).
- Set the first condition: event_name equals click.
- Add a second condition: link_url contains amazon.com.
- Check the option to Copy parameters from the source event.
- Test the Partner Click Event:
- Click on your affiliate link to Amazon.
- Check DebugView to see the partner_click event along with the general click event.
- Mark the Partner Click Event as a Conversion:
- In the Events section, toggle the option to mark partner_click as a conversion.
- Alternatively, go to the Conversions section and click New Conversion Event.
- Enter the exact event name partner_click and click Save.
- View Conversion Data:
- Allow time for the data to populate.
- Go to the Conversions section and click on the partner_click event to see the report.
- In the traffic acquisition report, select the partner_click event in the conversions column to view specific data.
Those are the steps to track affiliate links with GA4. We’ve determined how to see affiliate data, track outbound link clicks, create a custom partner click event, and mark events as conversions in GA4.
Check out our article How to Set Up GA4 Conversion Tracking for a comprehensive guide on the three ways of tracking conversions on your website.
Have you enabled enhanced measurements on your GA4 implementation? What events do you mark as a conversion? Let us know in the comments below!