Skip to main content

How to Audit Your Affiliate Links

If you want to make money from your website, affiliate marketing is one of the most popular tactics you’ll find. But as your site grows, so to will the number of affiliate links that you use to earn money.

And as your site ages, some of those links will stop working. A company you’re promoting might change affiliate networks or otherwise change the structure of their URLs, a promotion might end…there are lots of reasons.

You’re still sending traffic to that website, but you’re no longer getting paid because your tracking links aren’t working. Additionally, your affiliate links might go to 404 pages, which is annoying for your users.

That situation is why you want to periodically audit your affiliate links to find links that are no longer working. If you find any broken links, you can update them to make sure you get credit for the sale, or promote a different offer if that company no longer has an affiliate program.

In this post, I’ll show you how to automatically audit all of the affiliate links on your website to find broken links.

How We Manage Affiliate Links Here at WPLift

To make it easier to manage and audit your site’s affiliate links, we’d highly recommend an affiliate link plugin. Not only will such a plugin create “pretty” cloaked links, but it will also help you keep track of every single affiliate link on your site and export those links for manipulation.

Here at WPLift, we use one called ThirstyAffiliates. Check out our full ThirstyAffiliates review.

ThirstyAffiliates Pro actually offers its own Link Health Checker feature to monitor your affiliate links for broken links, but I like the manual methods that I’m going to detail in this tutorial because they won’t add any load to your WordPress site’s server.

That is, you’ll be checking all the links using someone else’s processing power (Google’s processing power, in one case!).

While I will be referencing ThirstyAffiliates as I take you through the tutorial, the basic tactics can be used with any affiliate link management solution.

Basically, as long as you can get a list of your affiliate links, you’re set to jet and will be able to use these methods to check for dead affiliate links.

How to Audit Affiliate Links for Broken Links

The basic process is simple:

  1. Get a list of your affiliate links – a CSV file works great.
  2. Check all those links for 404 errors or other error response codes

Here’s how to do it…

Part 1: Export Affiliate Links as a CSV

To get started, you need to collect all the affiliate links that you use on your site into a single list – I’d recommend a CSV file because it makes things easier in Step 2.

One of the reasons that we like ThirstyAffiliates is that, in addition to its built-in link health checker feature, it also makes it super easy to export all your affiliate links as a CSV (note – this is only available in the Pro version).

If you’re using ThirstyAffiliates, you can export all your affiliate links as a CSV file by enabling the CSV Import/Export module and then going to ThirstyAffiliates → Export CSV.

If you’re using a different solution, your affiliate link plugin might also support CSV export. Or, if the plugin is storing your links as a custom post type, you could try something like WP All Export.

Part 2: Check Affiliate Links for Broken Links

Once you have a list of all your affiliate links, it’s time to check them to find the broken ones.

To do that, you’ll need to click on each link and see if it works, so get a fresh cup of coffee and set aside an afterno…just kidding! That would be pretty miserable.

No, we’re going to automate this, and I’m going to give you two methods that you can use:

  1. Atomseo tool – a convenient online tool, but only lets you check 300 links for free.
  2. Google Sheets + a simple script – check unlimited links for free using Google’s processing power.

If you have fewer than 300 affiliate links, I’d recommend the Atomseo tool as it’s the simplest option. Otherwise, go with Google Sheets.

While the Google Sheets method does require you to use a code snippet, I’ve provided the exact code snippet that you need to use, so it’s still pretty simple.

Atomseo Method – Good for Up to 300 Affiliate Links

Using the Atomseo link checker tool is super simple. All you need to do is head to the tool and then either…

  • Paste in a list of affiliate URLs
  • Upload your CSV file (or TXT or XLS)

Then, hit Check to start checking your URLs:

Paste in list of affiliate links

Atomseo will then check all the URLs. If it finds any errors, that indicates a broken affiliate link. Atomseo will also display the exact affiliate link that isn’t working:

how to audit affiliate links with atomseo

Google Sheets Method – Good for 300+ Affiliate Links

If you have more affiliate links than you can check with the free version of the Atomseo tool, you can also use Google Sheets and a simple code snippet that you add to Google’s script manager.

To get started, open the CSV file with all of your affiliate links in Google Sheets. Then, go to Tools → Script editor in the Google Sheets interface:

Google Sheets script editor

This should open Google’s script editor tool in a new tab. Name the function as getStatusCode() and then paste in the following code snippet:

function getStatusCode(url){
var options = {
'MuteHttpExceptions': true,
'AllowRedirects': false
url_trimmed = url.trim();
var response = UrlFetchApp.fetch(url_trimmed, options);
return response.getResponseCode();

Then, save your changes and go back to your CSV file:

Add script

In Google Sheets, edit the column next to your list of URLs and enter =getStatusCode(A1):

Add formula to column

Then, drag it down to cover all of your URLs. Once you do that, you should see the HTTP status code of each link in the column next to the link. If you see “200”, that means the URL is working normally. If you see #ERROR, that means there’s a problem with the link and it’s probably broken:

Audit affiliate links status

If you have a ton of links, you can use conditional formatting to make it easier to see which links are working and which have problems:

Conditional formatting

And there you have it! A way to essentially audit unlimited affiliate links for free using Google Sheets.

Audit Your WordPress Site’s Affiliate Links Today

Affiliate marketing is a great way to make money from your WordPress site. But as your site grows and ages, it’s likely that some of your older affiliate links will stop working.

Maybe the link was a limited time deal…maybe the company changed affiliate networks…who knows.

If that happens, your links will stop working. Not only is that annoying for your visitors who’ll encounter an error, but it also means that you’re missing out on potential affiliate commissions.

To fix that, commit to following the steps in this tutorial and periodically auditing your affiliate links.

Do you have any questions about how to audit your site’s affiliate links via the method I laid out in this post? Ask away in the comments and we’ll do our best to help!

WordPress Design, WordPress Development, cPanel Hosting, Web Design, Web Development, Graphic Design, Mobile Development, Search Engine Optimization (SEO) and more.