How to Track Affiliate Links in WordPress
Most affiliate sites track too little: they know total earnings but not which article produced them. With a bit of setup you can see exactly which page, which link and which position earns — and then write more of what works.
Step 1: Organise your links with a plugin
Install Pretty Links, ThirstyAffiliates or AffiliateWP’s link tools. These let you turn a long affiliate URL into a clean link on your own domain:
yourdomain.com/recommends/hosting
Benefits: links look trustworthy, you can update the destination everywhere by editing one record, and clicks are counted automatically. Set the redirect type to 307 (temporary) for affiliate links so you stay compliant with most programmes.
Step 2: Mark links correctly
Add rel="sponsored nofollow" to affiliate links. This is required by Google’s guidelines and by most affiliate programme terms. Most link plugins add it automatically — check the setting and confirm in the HTML.
Step 3: Add UTM parameters
UTM tags identify the source of a click inside your analytics. A standard pattern:
?utm_source=yourblog&utm_medium=affiliate&utm_campaign=hosting-review&utm_content=sidebar
Useful conventions: utm_source = your site, utm_medium = affiliate, utm_campaign = the product, utm_content = the exact link position. Be consistent or the reports become useless.
Step 4: Track clicks as events in GA4
Clicks on outbound links are not tracked by default. Options, easiest first:
- Google Tag Manager — create a trigger for clicks on links matching
/recommends/and fire a GA4 event namedaffiliate_clickwith the link path as a parameter. This is the most flexible free method - Your link plugin’s built-in analytics — Pretty Links and ThirstyAffiliates both count clicks per link out of the box
- A dedicated plugin — some affiliate plugins push click events straight into GA4
Step 5: Mark the event as a conversion
In GA4, go to Admin → Events, find affiliate_click and toggle Mark as key event. Now clicks appear in your reports alongside other conversions, so you can compare pages properly.
Step 6: Build a simple report
Create an exploration or a standard report showing:
- Clicks by landing page — which posts drive the most interest
- Clicks by link — which products people actually want
- Clicks by position — whether an in-content link outperforms the sidebar
- Click-through rate — clicks divided by pageviews per post
Step 7: Connect clicks to earnings
Click data tells you about interest; the affiliate dashboard tells you about money. Export both monthly and join them by product. The posts that send fewer but better-converting clicks are usually the ones worth expanding.
Practical habits that improve results
- Place links where intent is highest — after a recommendation, not only in a sidebar
- Use descriptive anchor text ("see current Hostinger pricing") rather than "click here"
- Add a clear disclosure near the top of any post with affiliate links — it is legally required in many countries and builds trust
- Check for broken affiliate links monthly; expired offers waste traffic and damage credibility
- Update seasonal deal posts before the peak, when clicks are worth the most
Mistakes to avoid
- Cloaking without
rel="sponsored"— a guidelines violation - Using 301 redirects for affiliate links, which can confuse attribution
- Tracking clicks but never looking at the report
- Adding dozens of links to one post — conversion rate usually drops
- Promoting products you have not tested; readers can tell, and so can your returns