How to Mask Affiliate Links in WordPress with the Pretty Links Plugin

If you’re running an affiliate blog, then it makes sense to mask or shorten your affiliate links. People are sometimes hesitant to click on them when they see the affiliate string in the URL, and another reason is that affiliate links are hideous! Also, to comply with Google, it’s always good to ensure affiliate links are automatically marked as nofollow.

In this tutorial, I will show you how to install the free Pretty Links WordPress plugin and configure it for Google and performance. This is an awesome little plugin that allows you to create custom masked links with your own domain and track clicks on those links. I use the Pretty Links plugin on all of my websites.

You can grab the free Pretty Links plugin from the WordPress repository, or follow the steps below to install it from your WordPress dashboard.

Step 1

In WordPress under Plugins click on “Add New.”

WordPress add new plugin
WordPress add new plugin

Step 2

Search for Pretty Links and click on “Install Now” under “Shortlinks by Pretty Links” and then click “OK.”

Install the Pretty Links WordPress plugin
Install the Pretty Links WordPress plugin

Step 3

Then click on “Activate Plugin.”

Activate Pretty Links WordPress plugin
Activate Pretty Links WordPress plugin

After you’ve installed the plugin, it’s now time to configure the settings.

Default Affiliate Links to 301 and Nofollow

The first thing you should do is click into the Pretty Links plugin settings and set the following:

  • Change the redirection type to “301 (Permanent).” Most likely you’ll be using the same shortened links for years, so a permanent status is what they should be set to.
  • Confirm that the links are set to “nofollow.” Google’s guidelines say that affiliate links should be set to nofollow. If this is set in the plugin settings, you don’t ever have to worry about forgetting to manually place this in the HTML code.
Pretty Links default to 301 and nofollow
Pretty Links default to 301 and nofollow

Settings to Speed up Pretty Links

Shortening plugins like this can harm your WordPress site’s performance. This is why I always configure the following two options under the “Reporting” section:

  • Change the tracking style to “Simple Click Count Tracking.” You will get fewer stats, but it will be faster.
  • Enable the option to “Auto-Trim Clicks.” This will automatically delete all hits older than 90 days. This will help keep your database smaller.
Speed up Pretty Links plugin
Speed up Pretty Links plugin

I can’t stress how important the auto-trim feature is. If you don’t enable this, over time the _prli_clicks table in your database will get out of hand with thousands of rows.

To add a new masked (shortened) affiliate link click on “Add New” under the Pretty Links menu.

In the “Target URL,” input the affiliate URL destination. Make sure you are using HTTPS links. Google Chrome 80 now enforces using secure (HTTPS) links due to SameSite cookies.

Then choose your “Pretty Link” URL. I always use the following format so that I can track things separately in Google Analytics easier. You could change /go/ to whatever you want. Or not even have a separator.

domain.com/go/name

Add shortened link in Pretty Links plugin
Add shortened link in Pretty Links plugin

Then hit “Publish.”

You can now use your new URL anywhere on your website and it will redirect to the actual affiliate URL. You can view hits on the link within the Pretty Link dashboard. You can also edit your shortlinks at any time.

Pretty Links affiliate links dashboard
Pretty Links affiliate links dashboard

Summary

For any website running affiliate links, this plugin is a must-have. It will save you a lot of time, help you comply with Google, and give you the data you need to see which links are getting clicked on.

Did I miss anything important? Feel free to leave your comments below!

Get More Stuff Like This

Marketing, WordPress, Blogging Tips, SEO and Reviews, twice a month.

Thank you for subscribing.

Something went wrong.

Brian Jackson

Co-founder at forgemedia. Blogger and entrepreneur obsessed with SEO, marketing, and web performance. Connect on Twitter @brianleejackson.

14 thoughts on “How to Mask Affiliate Links in WordPress with the Pretty Links Plugin”

  1. I was using some mad redirect plugin which messed up my permalink structure (still trying to fix), but I am now using Pretty Links and it seems to be doing the job. I also like analytics it gives.

    Reply
    • Hey Harry! Ya I have been using Pretty Links for probably almost 5 years now. Probably one of the only plugins I have never had any problems with. Works great.

      Reply
  2. Hi Brian, thank you for the step-by-step instructions. I have a question I hope you can help with. I read somewhere on line that if ones wp site goes down for any reason the pretty links won’t work where you have placed them. Is this correct? Oh, I plan on using the free version. Will this do? Thank you for your time. Tracy

    Reply
    • I use the free version on all of my sites Tracy. And yes, if your site goes down the Pretty Links won’t work. But if your site is down, well, they shouldn’t be clicking on your links anyways :) I don’t use Pretty Links offsite.

      Reply
    • I have been using the free version of Pretty Links for probably 5+ years now. I’ve never had a single problem.

      Reply
  3. Hi. So I downloaded this plug in per your recommendation. I want to use it for when I link to external links (affiliate or not). I am at the point where you added infolinks as the pretty link, but I dont understand what target url to use. Every link I attach to will be a different url… I was thinking that it would put an attachment icon where I write my post. Then a box would pop up and I’d put the target url in there. That is not what happens, so I am pretty confused. Thanks!!

    Reply
    • The target URL is your external and or affiliate link (where you want it to go). You have to create additional links within the Pretty Link settings dashboard. You then use the “prettylink” that it generates within your post.

      However, for SEO reasons I wouldn’t use the plugin to normally link to external sites. You don’t want a redirect happening to normal sites. I only use the plugin for affiliate links.

      Reply
  4. This plug sounds as the right one to install. Before we install it, can you specify if the “masked” link can be edited? We are looking for our body building site, to send traffic to affiliated vendor. Thanks.

    Reply

Leave a Comment