Replacing Amazon Affiliate Links on a Newly Acquired Website

Replacing Amazon Affiliate Links Site-wide

After acquiring a website, getting it moved to your own hosting server and taking control of the domain name, the first thing you’ll likely want to do is update all the affiliate links on the website. There may be hundreds of these on your site, so you really don’t want to replace those links manually. If the previous owner used a link manager plugin, you’re probably in luck. If the links were all created manually, not so much.

Turns out, there’s a plugin that’ll replace all the Amazon product links on your website automatically – Hekkup’s Add & Replace Amazon Links plugin – and it’s free. You can find the plugin here: https://hekkup.com/add-replace-amazon-links-plugin, and the instructions for using it here: https://wordpress.org/plugins/add-replace-affiliate-links-for-amazon/. The plugin will even replace short Amazon links (amzn.to), add a No Follow tag and set the link to open in a new tab.

Be sure to read the instructions (they’re extremely brief), and heed the advice to use the Backup function before you do anything else. (Turns out it saved me.)

Use the Plugin’s Backup Function

I ran into a bit of a problem when using the plugin. I have not tried to recreate the sequence of events exactly, but something did go wrong along the way. The details are probably not important, but the warning to use the plugin’s Backup function turns out to have been important. Likewise, you should backup your website, as usual, before making any widespread changes like this.

In a nutshell, when I first applied my new tracking ID, and ran the plugin, it may well have worked fine (I don’t really know). But, after that initial run, I clicked on the “Nofollow” button, which I assumed was a setting, and not a “run” command, the plugin began to run again. After several minutes, the plugin appeared to hang – it stopped showing progress. Clicking on the plugin’s “Update pages” menu item in the left navigation area, showed me that the same post had been updated somewhere north of 50 times (there are only a handful of links on that page, so it wasn’t just posting an entry for every edit). Clearly, something was amiss. Thinking that the plugin was stuck in a loop of some kind, I tried to de-activate it.

After a series of attempts to get back to where I started, I eventually deleted the plugin, and restored all the files and databases in my website (it’s only a couple of clicks in Siteground’s control panel, so simple). Even that didn’t clear things up. After re-installing the plugin and launching it again, it reported the exact same completion percentage (and start time) as the original execution. I have no idea where that data was stashed, that my site restore didn’t remove it, but there it was.

The actual solution was to click on the plugin’s Restore button. Then, I simply re-entered my tracking ID and ran it again, and presto! Checking a handful of the affiliate links, they were now showing my tracking ID.

Watch out for hidden affiliate links

One more (sort of) caveat: my particular website still contained some of the previous owner’s Amazon affiliate links. Turns out, another plugin on the site was automatically inserting Amazon native ads, and those were not picked up by the Add & Replace plugin. It’s easy enough to manually replace that one instance, but you do need to check for it.

Check your results

Next, I ran an Ahref’s site crawl, so I could export all the outgoing links, and make sure I got them all. Purely by chance, I had run an Ahref crawl while waiting for the initial Add & Replace plugin run to execute. When looking at the first Ahrefs crawl results, I saw hundreds of 404 errors. After restoring my website, re-running the plugin, and crawling the site again, all those 404s were all gone, so my suspicion is that the apparently looping plugin had generated many, many versions of the post it had been working on, and my website restore had fortunately removed those.

Moral of the story: backup your website before making any widespread changes, and follow the recommendations of the plugin creator. Finally, if something odd occurs, be sure to run a website crawl after, to make sure everything is still in order.

The Bottom Line

Hekkup’s Add & Replace Amazon Links plugin save me many, many hours of manual updating work. There was a bit of a glitch, but since I found an easy solution, it turned out not to be a problem.