How to Cloak Affiliate Links (& Why You Should)

I always run my affiliate links through redirects – also referred to as cloaking affiliate links – for several reasons:

  • Running them through my redirects means I have a click count to match up to the one the merchant is reporting.
  • Affiliate links are usually ugly and impossible to remember without doing a copy/paste. Redirects allow you to create short, memorable URLS for them and allow you to access commonly used affiliate links from memory.
  • If you're in an industry where you market to other affiliates, it can help prevent folks from switching out your affiliate ID with theirs.
  • If the merchant decides to change networks or linking methods, you can edit a single redirect instead of needing to edit every instance in which you linked to them throughout your entire site.
  • If you decide to change which merchant you're using to promote a product, you can edit one redirect instead of needing to edit every instance in which you linked to them throughout your entire site.
  • If a handful of the merchants I mention on a regular basis don't have affiliate programs, I'll often still cloak the link to their main website. This way, if they ever do launch an affiliate program, I can affiliate all my previous links to them by updating the one cloaked link.
  • If you're running an affiliate datafeed site, anything you can do to make your site more technically unique than the other 4000 affiliates using the same datafeed is a bonus in regards to affiliate datafeed SEO.

What does it mean to cloak affiliate links?

Cloaking an affiliate link just means that you are creating URLs on your website that redirect to an affiliate link. For example:

This is my affiliate link for Optin Monster without cloaking it: http://www.shareasale.com/r.cfm?b=601672&u=313242&m=49337&urllink=&afftrack=

This is my affiliate link for Optin Monster after cloaking it: https://sugarrae.com/getit/optinmonster

Both links go to the same place, and both links will track my affiliate cookies correctly.

How to create cloaked affiliate links

You don't have to use a plugin to create cloaked affiliate links. You can do so with this method detailed out by Yoast or by using your .htaccess file.

However, you should never touch your .htaccess file unless you're well versed in using it because making an error within it could take down your whole site. Using .htaccess or the Yoast method for manually cloaking affiliate links means that you lose out on the additional features a link cloaking plugin can provide.

There are several affiliate link cloaking plugins on the market, but I use the Pretty Link Pro WordPress plugin to cloak my affiliate links.

(Disclosure: I came across Pretty Link Pro years ago and paid for the plugin out of my own pocket. Pretty Link Pro has an affiliate program that I signed up for once I already owned and began using the plugin. I link to the plugin using affiliate links. This means that at no extra cost to you, I may receive a commission if you purchase the plugin.)

There is also a free version of the plugin called Pretty Link Lite, but the Pro version has features I won't do without – like being able to change the base slug in the cloaked links.

Installing Pretty Link Pro

Once you have purchased and downloaded the plugin you'll need to install it.

  1. In your WordPress dashboard, head to Plugins > Add New
  2. At the top of the next screen, click on the Upload a Plugin button
  3. Choose the PLP plugin file from your computer and click Install Now
  4. On the next screen, click Activate Plugin

The plugin is now installed and ready for setup.

Verifying your purchase of Pretty Link Pro

In order to enable the advanced features in the plugin, you'll want to verify your purchase of the plugin before setting things up.

  • Look for a tab labeled Pretty Link in the left hand menu of your WordPress dashboard
  • Mouse over the Pretty Link tab so that the submenu pops up
  • Click the last link in the list labeled Pretty Link Pro
  • On the next screen enter your username and password for the account you created at Pretty Link Pro when you purchased the plugin
  • Click Save
  • Click the Get Started link at the top of the resulting screen

Once you've verified your purchase, and click the Get Started link, you'll notice a message at the top of the screen in the Pretty Link admin section saying a database upgrade is required. Click the Automatically upgrade your database link and the plugin will perform the update for you.

Setting up the options in Pretty Link Pro

Pretty Link Pro has a ton of features, but I'm going to keep things simple and walk you through the core options I setup when I install it so that you can get started without being overwhelmed with all the additional features you may or may not want to use. Think of this as a quick start guide.

Setting up the Basic Options

Click on the Options link under the Pretty Link navigation pane in the left menu of your WordPress dashboard. On this page, you'll see three expandable options: Link Options, PrettyBar Options, and Reporting Options. We're going to expand and focus on the Link Options and Reporting Options in this section.

Link Options

Click on the [+] symbol next to the Link Options section to expand it.

Pretty Link Options Setup Screen

  • Track Link will be checked by default and should remain that way
  • I also check off the nofollow option so that all of my cloaked links are nofollowed by default
  • The Default Link Redirection Type will default to a 307 Temporary Redirect and I leave it that way
  • Once everything matches the screenshots above, click Update Options at the bottom of the screen

Reporting Options

Once you've set up the basic Link Options, you'll want to expand the Reporting Options section.

Pretty Link Reporting Options Setup

  • I exclude my IP address so that Pretty Link doesn't include my clicks on any Pretty Links in reporting
  • The plugin tells you what your IP address is, so you can copy and paste it into the IP field above
  • I also check off the option to exclude known robots
  • Normal Tracking will be checked by default and I leave it that way
  • Once everything matches the screenshots above, click Update Options at the bottom of the screen

Note: If you're using a plugin like Broken Link Checker to crawl links on your site, you're going to end up with skewed click reporting because Pretty Link will track the clicks from the plugin and include them in the reporting. So if you're using that plugin – or one like it – you'll want to exclude your website's IP address in the Excluded IP Addresses field. You can find the IP address of your website here.

Setting up the Pro Options

Once you have the basic options set up, you can navigate to the Pro Options under the Pretty Link navigation pane in the left menu of your WordPress dashboard. On the next screen, you'll see six expandable options: Keyword & URL Replacement Options, Page and Post Options, Twitter Options, Social Network Options, Public Link Creation Options, and Global Options.

Once again, we're going to keep things simple and focus on the Keyword & URL Replacement Options and Global Options.

Keyword & URL Replacement Options

What this section does: Whenever you create a Pretty Link, you can define keywords or phrases that should be assigned to it so that Pretty Link links instances of that word or phrase to your Pretty Link for that affiliate program automatically.

Using the automated keyword and URL replacement options opens you up to the risk that you may have undisclosed affiliate links on your site. To ensure compliance with the FTC disclosure guidelines for affiliate links, I prefer to hard code the Pretty Link affiliate links like I would a regular link. This way I can ensure that I ensure I have disclosure clearly stated within any content that has an affiliate link.

Because of that, I disable this option by unchecking the box next to Keywords and URL Pretty Link Automatic Replacement and clicking Save.

Pretty Link Disable Keyword Replacement Options

It was a feature I used before the launch of the FTC guidelines, but I prefer to err on the side of caution and not risk getting sued for failure to disclose.

Global Options

This section allows you to change out the base URL for your Pretty Links. By default, your Pretty Link would look like this:

http://yourdomain.com/myprettylink

However, I prefer to keep all of my Pretty Links in a subfolder so that I can easily prevent Google from crawling them (we'll cover that further down in the post).

Pretty Link Global Options Setup

  • I check off the box next to Use an alternate Base Url for your Pretty Links
  • I add the Pretty Link Base URL into the field that appears when I check the box
  • Set Minimum Role Required To Access Pretty Link is set to administrator by default and I leave it that way
  • Once everything matches the screenshots above – with your personal URL in place of the URL in the screenshot – click Save at the bottom of the screen

You can make the base URL whatever you'd like it to be, but be sure not to add a trailing slash to the end of the URL. Some common base URLs people use include out, go, goto, link, etc.

Once again, Pretty Link has a ton of features I didn't cover within this post, but the above are the essential features I setup for every site. You can poke around with the more advanced features as you become more comfortable with the plugin.

Preventing Google from crawling your Pretty Links

Once you have a custom subfolder setup to handle your Pretty Links, you'll want to prevent Google from accessing that folder by using a disallow directive in my robots.txt file. Search engines don't want to waste resources crawling your redirects, and I'd prefer they stay away from my affiliate links anyway, so they don't see tons of redirected links on my site.

If you're using the WordPress SEO Plugin by Yoast, this is easy to do. From your WordPress dashboard, go to SEO in the left-hand sidebar and choose Tools > File Editor.

If you don't already have a robots.txt file, this screen will give you the option to have the WordPress SEO Plugin create one for you. Once you have a robots.txt file, add the following directive to it – replacing /out/ with whatever you used in your base URL in the Global Options section above:

User-agent: *
Disallow: /out/

Then click the Save changes to Robots.txt button below the box.

If you're not using the WordPress SEO Plugin, you'll find instructions for creating and editing a robots.txt file here.

Creating Pretty Links

Now that you have the plugin basics setup, you're ready to start creating some cloaked links. Click on Add New Link under the Pretty Link menu in the left side navigation of your WordPress dashboard.

Creating a New Pretty Link

  • The Redirection Type will automatically be set to a 307 because we set that up as the default in our basic options
  • ‘Nofollow' this Link and Track Hits on this Link will also be checked for the same reason
  • In the Target URL, you'll put your standard affiliate link for the program
  • The Pretty Link box will contain a random string by default that you can change to be whatever you like
  • The Title for the link is for backend purposes, so you will know what program or product each Pretty Link is for
  • Choose a Group to assign the link to if applicable – see below Groups section
  • Click the Create button at the bottom of the screen

You'll note that the Parameter Forwarding Enabled option is unchecked and is left that way. Pretty Link says that parameter forwarding is a feature meant for developers looking to pass dynamic (changing) parameters into the target URL based on some action the user completed. That's not me, and that's probably not you.

You may have also noticed the Advanced tab – and that we didn't do anything with it. The Advanced tab is where you can assign a double redirect, assign keywords to a link if you left that feature turned on, and setup split tests – none of which are features I need or use.

Pretty Link Groups

The Group feature allows you to put links into specific groups to categorize them. Whether or not you use this feature will be a personal preference. I group some links, but not others. However, one thing I should note is that the Add a New Group function has never worked for me from the Add New Link screen. If I want to assign a link to a group, I need to go to the Groups section in the Pretty Link menu to create the Group if it doesn't already exist, before creating the first link I plan to place in it.

Pretty Link Add a New Group

  • Click Add a Pretty Link Group on the main Groups page found in the Pretty Link submenu
  • Name your Group
  • Give your Group a description if you'd like
  • If you have preexisting Pretty Links you'd like to add to the Group, you can check them off to do so
  • Click the Create button at the bottom of the screen

Segmented Groups Reporting

Pretty Links tracks clicks for all links, but if you have Groups set up, you can also see tracked clicks for links within a single group only. Mouse over the Group name on the main Groups screen and you'll see some options appear. If you click the Hits link, it will show you the click tracking report limited to links within that Group.

Pretty Link Groups Reporting Feature

Using Groups in Tandem with SID Tracking

Groups can be particularly useful for tracking how many clicks a particular page is generating – such as Start Here or Tools I Use style pages. For instance, I have a Group set up for my Toolbox page here on Sugarrae. The Pretty Links on that page are assigned to the Tools Group. Each of those links created within the Tools Group also contains SID tracking specific to the Toolbox page. I don't use those same links anywhere but the Toolbox page.

Using a group for the Toolbox page allows me to see how many clicks the page is generating and – using the SID tracking in tandem with that – allows me to compare click reports on my end with those reported on the merchant's end. It also helps me to track how many sales that page is generating because those links contain SID tracking other links to the same merchant do not (when the merchant program has SID tracking available).

General Pretty Link reporting

I mentioned segmenting Group reporting above, but you can find the standard reporting for all links by clicking the Hits link in the Pretty Link submenu from the WordPress dashboard.

Rae

Rae Hoffman aka "Sugarrae" is a veteran digital marketer and SEO consultant. She is also a serial entrepreneur. You can find out more about her entrepreneurial efforts here. Rae is most active on Twitter.

22 Comments

  1. Daniel Dessinger on May 3, 2016 at 8:31 pm

    So do you cloak your Amazon affiliate links? Because I’ve heard of quite a few people getting the hammer dropped on them for lesser things than that. Amazon technically wants readers to know that they’re going to Amazon before they click, and it reserves the right to shut down or suspend an affiliate account for violating TOS.

    Quite a few health bloggers have extensive affiliate disclosures to help assuage Amazon specifically.



    • Rae on May 3, 2016 at 9:04 pm

      Yes, I cloak my Amazon links, but I’m also not a heavy Amazon affiliate, so I’m not super in-depth on their idiosyncrasies. Not sure I buy that the standard user would pay much attention to the mouseover link in the bottom left of their browser, but if the argument is they want people to know they’re going to Amazon, I think disclosure next to the link (Amazon affiliate link) should suffice, and you have to disclose it’s an affiliate link anyway to pacify the FTC, adding Amazon in front of it is no extra effort. That said, some of the old cloaking plugins used to use iframes, etc. that would obscure the end URL the user was on, which would have definitely violated that – and purposely – so that might be in play as well.

      The only reference I can find to cloaked links in their documentation is: “You will not cloak, hide, spoof, or otherwise obscure the URL of your site containing Special Links (including by use of a redirecting page) or the user agent of the application in which Content is displayed or used such that we cannot reasonably determine the site or application from which a customer clicks through such Special Link to the Amazon Site.” The bold there is my doing. My site is still the referrer. I’m not attempting to hide my site as the referrer – only track the link. So, I think they haven’t defined that super well.

      The Amazon linking guidelines say, “In addition, you must not use a link shortening service in a manner that makes it unclear that you are linking to an Amazon Site.” Bolding is once again mine and again, I see gray here. I’m not using a shortening service. I’m running them through links on my own site. If clarity is the issue, then see my comment re disclosure via (Amazon affiliate link) above.

      And, personally, the diet and health blogging sectors tend to have a higher concentration of scumbags with knowledge of advanced tactics than most, so I’m not surprised Amazon is up their collective ass on how they can promote them.

      I’ll try and see if I can get some clarification on it.

      My opinions on their verbiage aside – if this were a concern for someone or someone was heavily reliant on Amazon as an affiliate, then simply don’t cloak the Amazon links. You choose which links get cloaked (based on the setup of the plugin detailed above). So you can choose to leave Amazon links alone and cloak the rest.

      TLDR: I can’t know the rules for every affiliate program ever. In the ten+ years I’ve been cloaking affiliate links on my site internally, I’ve never had an issue. But if in doubt about a program, check its TOS and do as you see fit based on that. :)



      • Rae on June 22, 2016 at 4:52 am

        Update re my comment above: The FTC has updated their guidelines to say (affiliate link) next to a link is no longer acceptable. See this post.



  2. Vince on June 7, 2016 at 6:26 pm

    Nice plugin, I was doing this manually in pretty the same way until now.
    I have just a question: when I do a source on the page I don’t see a rel=”nofollow” on the pretty link although I have set it up twice in the plugin (general option and on this particular link)
    how to be sure the search engine will see it as a nofollow?



    • Rae on July 7, 2016 at 6:55 pm

      So, I ended up having a lot of back and forth over this. When I first started using PLP way back, the nofollow was on the link itself in the HTML of the page. After your comment, I contacted them because mine were gone too (it only took a long back and forth because I was in the Dominican for a month and slow as hell in responding to their email replies). Their support team looked into it.

      At some point, they changed to serving the noindex and nofollow directives in the http response header vs. having it in the HTML itself. I’m not sure of their reasoning for that, but I did confirm that all of my affiliate links I’ve labeled to be nofollow are indeed serving up a X-Robots-Tag: noindex, nofollow in the server response. Hope this helps! And it taught me they’d changed the handling of it – so that was good info to get. :)



  3. Kane on June 24, 2016 at 2:51 pm

    We working with a site that has thousands of affiliate links which go to specific products across Amazon and dozens of other vendors. I’m curious if you have advice on managing that many links. We’d probably try and group them both by post and by vendor, eg create a link called domain.com/getit/amazon-blue-widget-20-oz/ and then put that in the “Blue Widgets” group of a plugin like Pretty Links. But, I feel like there are likely opportunities beyond just the naming conventions like that.

    Also, in regards to the Amazon link discussion here in the comments, I’d imagine simply putting “amazon” in the pretty link URL path would be enough to mitigate any concerns.



  4. Jguiss on August 14, 2016 at 8:36 am

    Nice tutorial. I bought it this morning but I was looking how to add sub folder for all my created links… and you gave me the solution with the screenshot “Pretty Link Base URL”, I believe this part was for adding a custom URL :) I also edited the robots.txt with Yoast SEO thanks to you!



    • Rae on August 14, 2016 at 8:43 am

      Glad you found it useful! And yep, the base url is how you add the custom URL. :)



  5. John on December 8, 2016 at 10:51 am

    Personally I use a link shortener as I do not have many affiliate links. I use sites such as tny.gd or tiny.cc

    Hope this helps :)



    • Rae on December 31, 2016 at 8:40 am

      You have to be careful doing this as those free sites can go down at any time, the links could change, and you’d have zero control in changing where they redirect to. It’s happened before. I personally would never, ever use them – especially for this purpose.

      For instance, you might link to multiple affiliate links using some third party URL shortener, but then it goes out of business, a porn site buys it and suddenly every affiliate link you’ve published using it redirects to a porn site.



  6. Rie on January 19, 2017 at 6:38 am

    Hello,

    If I use Pretty Links Pro and block Google from accessing my re-directs folder – will that not also block broken link checkers such as Integrity from finding my broken affiliate links?

    I have used re-directs before but found that Integrity and Screaming Frog weren’t finding broken links. Was this perhaps because I was also blocking access in robots.txt?



    • Rae on February 12, 2017 at 8:38 am

      I don’t know anything about the Integrity program you’re using. Re Screaming Frog, they can follow the redirects. So, what you can do to test them using Screaming Frog is to do the following to check the validity of your redirects every few months.

      1. Open Screaming Frog
      2. Go to Configuration > robots.txt > Settings and check “Ignore robots.txt”
      3. Crawl your site with Screaming Frog
      4. Click on the Response Codes tab
      5. Limit results to only showing you Redirection (3xx) results
      6. Export the results
      7. Open it in Excel
      8. Delete the “Response Codes – Redirection (3xx)” top row
      9. Under the data tab, filter the results so you can sort them based on each column
      10. Now you have two choices: on my site, the affiliate redirects are the only ones that use 307 status codes, so I’d filter the results to only show me those status codes. You can also filter the results in the address to column to only show urls that contain the name of your affiliate links sub-folder: /your-folder/
      11. Copy the urls from the Redirect URI column after you’ve filtered them to only your affiliate redirects
      12. Go back to Screaming Frog, and go to Mode > List
      13. Click Upload next to where the address bar to enter the url to crawl normally appears and click Enter Manually
      14. Paste the Redirect URIs you copied from excel into the resulting box and follow the prompts to start the crawl
      15. This will present you with the status codes from the affiliate URLs – then investigate any redirects or 404s the same as you would if they were identified using a broken link checking tool

       
      Hope this helps!



  7. Jeanine on March 13, 2017 at 2:35 pm

    Great article with helpful tips. I have now set up the cloaking, but I was wondering about the following. Since all the links are redirects, it takes some seconds to load the links. Therefore I would like to show an “exit page” that says something like: Just waiting to redirect you to.. (shop name).. just a few seconds..

    Do you have a tip on how to show an exit page like that?



    • Rae on May 7, 2017 at 10:12 am

      Honestly, if they’re taking that long a time to redirect, IMHO that means you need a better host. It should be almost instantaneous. That implies slow hosting – which isn’t good for multiple reasons, including this issue. :)



  8. Tommy on March 14, 2017 at 12:28 pm

    Hey Rae,

    have you experienced any traffic drops from Google search on pages with nofollow affiliate links?

    I had a page that was consistently near or at the 1st position for high traffic keywords in Google. I added a few nofollow affiliate offers to the page it dropped to the bottom of the first page.

    Have you experienced anything similar?



    • Rae on May 7, 2017 at 10:11 am

      Nope. I’ve never had rankings change as a result of adding nofollows.



  9. David on March 31, 2017 at 4:42 pm

    Hello

    I’m confused as to how to set up a sub folder – could you elaborate?



    • Rae on May 7, 2017 at 10:10 am

      Yoast has an article on doing it using the subfolder method here.



  10. Linette on June 23, 2017 at 12:04 pm

    Hi!
    I am completely new at ALL of this and I want to incorporate affiliates, but most every resource I have found for insight uses WordPress. Can I incorporate all of these features if my blog is through SquareSpace?

    Thanks!



    • Rae on June 30, 2017 at 5:48 pm

      Hey there! Any site can pretty much have any feature – it’s the ease with which it can be employed and the how that can change from site to site. WordPress is immensely popular and thus has plugins to do most anything you could imagine. Unfortunately, I don’t use SquareSpace and wouldn’t know how to do any of this on it.



  11. Sean Glennon on June 29, 2017 at 2:23 pm

    I took the dive in and bought pretty link with your link here. My blog hasn’t earned any money yet, but I want to set everything up right the first time and I get pretty hesitant when I have to spend money. Anyhow thanks.



    • Rae on June 30, 2017 at 5:48 pm

      Thanks Sean – any questions about it, feel free to drop them here and if I can answer it I will!