Affiliate Links and SEO

Update: I’ve switched away from using WordPress plugins for redirects, as a non-WordPress solution turns out to be much faster. More details here: how to cloak your affiliate links. The bit about Analytics below is still relevant though.

Google will always say they won’t penalize you for affiliate links per se, but for thin content around it. I can make this into a long story, but let’s make it short: there’s very good reasons for me and several other highly respected SEO’s and affiliates around the world to think otherwise. Let me show you how to hide them.

In yesterday’s WordPress Podcast, Nathan Rice of StudioPress pointed us at a new plugin they’ve developed called Simple URLs. It works great, and I thought I’d use it to show you how to properly hide your affiliate links from Google. First of all, install that plugin. It will create a new custom post type and after that, you can very simply add a new redirect:

Creating a redirect with Simple URL's

Creating a redirect with Simple URL’s

Hit publish, and your redirect will work. The plugin will keep track of how many people followed the URL too, and show you in the overview:

Simple URL's overview and click statistics

Simple URL’s overview and click statistics

Now, you’ve hidden your affiliate link. However, Simple URLs will do a straight 301 redirect, this is good for lots of cases, but in this case that would mean Google would still end up at the final destination, and we don’t want that. So what you do is very simple: you go into your site’s robots.txt file, and you add one line:

Disallow: /go/

If you didn’t have a robots.txt file yet, you’d need to have at least one line above that:

User-Agent: *

This means that the lines below are valid for all search engines.

This will prevent search engines from following those links, and thus prevents you from being penalized for those affiliate links. Of course, if you’re a bit more hard core, the best way would be to go one step further. Then you’d do a conditional redirect on those links: if it was a search engine spider, you’d redirect them back to your homepage or another post, if it was a normal user, you’d redirect them to the affiliate link. That’s a bit shady though, so I wouldn’t recommend doing that if you’re not 100% sure you know what you’re doing.

Affiliate Link Analytics

Now if you start doing this, it’s also useful to add the outbound click tracking in my Google Analytics plugin. If you’ve enabled outbound click tracking, it will track your affiliate link clicks as events in Google Analytics:

Google Analytics for WordPress  click tracking setup

Google Analytics for WordPress click tracking setup

These will then show up in Analytics, go to Content > Event Tracking > Categories, and you’ll see something like this, as you can see the affiliate links have been suffixed with the label “aff” I chose above:

affiliate clicks in Google Analytics

affiliate clicks in Google Analytics

Good luck making some money on affiliate marketing, and make sure to hide those affiliate links!

53 Responses to Affiliate Links and SEO

  1. Craig White
    By Craig White on 24 October, 2010

    Great post as usual Joost, I am very new to affiliate marketing and didn’t realize that Big brother Google would penalize me for my affiliate links. I do have a question if you have the time to comment on this. Are you familiar with Maxblogpress Ninja affiliate plugin? Does this plugin cloak in the same manner as Simple URLs? Ninja affiliate seems to pack a big punch with all of the features it claims to have. Interested in your expert opinion.

  2. Chris
    By Chris on 23 October, 2010

    Thanks Joost, a thought provoking and useful post as always :)

    Just wondering…

    Couldn’t just having lots of 301 redirects going through robots blocked ‘out’ or ‘go’ links tip Google off that something fishy is going on? If your site is packed with 301 redirects which are not allowed to be viewed by Google, and it is something SEOs are beginning to do as standard to hide aff links, isn’t it a logical step for Google just to penalize sites with those sorts of links like they do with affiliate links anyway. In other words, it will eventually make no difference, assuming it doesn’t already. Maybe a manual reviewer might even consider it deceptive putting you in their bad books a little.

    Have you actually seen any strong evidence to suggest making this change had a positive effect on your rankings?

  3. John
    By John on 20 October, 2010

    Hi Joost,

    If this particular method wasn’t straight forward to integrate into your site, would the following example of managing your links with SEO in mind be ok / achieve what this plugin achieves?

    – Example outbound affi link:


    – In robots.txt file add: Disallow: /go.php

    (apologies – posted this comment in error over on the thread)

    • Joost de Valk
      By Joost de Valk on 20 October, 2010

      Yeah works too though not as cute ;)

      • John
        By John on 20 October, 2010

        Thanks and agreed :)

  4. Tweak
    By Tweak on 13 October, 2010

    Great tip

  5. marita
    By marita on 7 October, 2010

    Great tip to add the disallow to the robot file! Thanks! In your example you add only ‘akamai’, but the full URL has the /go/ in front of it – how did you get the ‘go’ in there? Adding the ‘go’ to all the links sure makes it a lot easier to exclude in the robots file.

  6. Graham Stoney
    By Graham Stoney on 6 October, 2010

    WordPress generates robots.txt automagically if you don’t have one. Is there an easy way to add the Disallow: line within WordPress?

  7. Spears Marketing
    By Spears Marketing on 6 October, 2010

    Thanks Joost, this will be a great help in tracking my affiliate links. I’ve been a Studiopress user since last December, and have been using the new simple URL plugin for a week or so, love both! Thanks again!

  8. Alex
    By Alex on 6 October, 2010

    When you have the time Joost, it would be mighty interesting to get some of this detail…”there’s very good reasons for me and several other highly respected SEO’s and affiliates around the world to think otherwise.”



    • David Doolin
      By David Doolin on 6 October, 2010

      Yes, please. I’m also very interested.

  9. Agent Wordpress
    By Agent Wordpress on 6 October, 2010

    I use gocodes which do not use custom post types. So, considering SEO in mind, which would be a better thing to do, using this plugin (and hence custom post types) or URL rewriting done by gocodes?

    Also, gocodes has an option to nofollow the redirections. Should I still disallow the serach bots?

    • Harsh Agrawal
      By Harsh Agrawal on 6 October, 2010

      Agent WordPress yes you should make changes in your robots.txt to nofollow such links..!!

  10. D Baker
    By D Baker on 6 October, 2010

    Great tip Yoast, I will surly start changing my affiliate links… It will probably take some time.

  11. Adriana Smith
    By Adriana Smith on 5 October, 2010

    Can I use this plugin for generating urls and using them on websites other than where I have created the URL. I want to say I don’t want to use it in a WordPress site but on a simple HTML site to hide the affiliate link. Can I do so? If not any simple technique you would like to share for redirecting affiliates link.

    • Chris Abernethy
      By Chris Abernethy on 5 October, 2010

      You could certainly use this plugin for that purpose, but you might be better served by creating mod_rewrite rules in a .htaccess file for your static HTML site if you only have a few affiliate links and don’t need a front-end management UI for that purpose. That way, you also have the benefit of your affiliate links showing as the same domain as the static HTML site.

  12. Chris Abernethy
    By Chris Abernethy on 4 October, 2010

    Wow, perfect timing! I was just getting ready to install GoCodes on several of my sites, but I like the way that Simple URLs is set up much more, not to mention the significantly more recent last update…

  13. Auke
    By Auke on 1 October, 2010

    Hi Joost,

    I have always been redirecting my affiliate links and I do so with in my .htaccess with a 301 redirect.
    This way I do not need a plugin for this… keeping my website from being bloated with plugins.

    • John
      By John on 1 October, 2010

      I used to do it that way too, but some sites have way to many affiliate links. This type of plugin really simplifies the process, let’s you do everything from the WP admin panel, and also provides click-stats. Combine it with KB Linker and you can easily automate affiliate linking for deep content sites (KB Linker is great for automating internal linking too).

  14. GIA
    By GIA on 30 September, 2010

    wow!! This is an extraordinary and this plugin is running smoothly on my blog …. Thank you sir

  15. Jenny
    By Jenny on 30 September, 2010

    cool. I’ll try this ’cause I have a bunch of affy links to put up and this is gonna make it better. ;P

    • Jenny
      By Jenny on 9 October, 2010

      woo! got it working :) so awesome.

  16. John
    By John on 30 September, 2010

    Is there any advantage to using Simple URLs instead of GoCodes? I’ve been using GoCodes successfully for a long time now, but I’m always interested if there’s something better.

    • David Doolin
      By David Doolin on 6 October, 2010

      John, I’ve used gocodes about a year. It’s very easy to use, and seems to have worked well for me. I’m going to try Simple URL though, and revisit gocodes.

      Redirection will do the same thing, but a lot more. It’s really heavy weight. I’m using it mainly for watching 404 logs.

    • Joost de Valk
      By Joost de Valk on 30 September, 2010

      Don’t know, I found this plugin, liked it and used it for the example :)

  17. Kenneth c Young
    By Kenneth c Young on 30 September, 2010

    As to the article on Affiliate links and SEO in regards to using redirects for your affiliate links are
    we using tactics that are against the policies of Google and if so what way does Google
    recommend for accomplishing this task?.


  18. Alan Niemies
    By Alan Niemies on 30 September, 2010

    Hello, Joost! Great post and great advice!
    I just got a problem when I try to use the plugin. Can you help me?
    I create a new URL on the plugin but everytime I try to go on it, it brings me a 404 error page on my blog. Take a look:

    Thanks for the help!

    • JB
      By JB on 6 October, 2010

      Sounds like you didn’t follow the instructions. According to the plugin’s FAQ:

      When I try to access my new URL, I’m getting a 404 (not found) error

      Sounds like you didn’t follow the installation instructions :-)

      Navigate to Settings > Permalinks and save them. No need to change anything, just click the save button.

  19. Michael
    By Michael on 30 September, 2010

    Good article, I totally agree with masking affiliate links + click event tracking with Google Analytics.

    However, I came upon a nice solution for affliate links in one of my projects wihich has really a lot of them ;) My solution is to not use the <a> tag at all and trigger outbound links via JavaScript with the click event. You simply define a class called outbound and then write a small JavaScript function which processes the click event on such elements and redirects to the affiliate link. Of course, you have to pass some sort of link id to the script, too. This can be accomplish in various ways, for example like this: aff link

    This way, I’m pretty sure Google can’t find any affiliate links on your site, except they analyse every JavaScript code on your site or something.

    • Joost de Valk
      By Joost de Valk on 30 September, 2010

      That would work, if Google didn’t parse JavaScript. They do though.

      • Joel
        By Joel on 1 October, 2010

        external js + robots.txt = no crawl

  20. Mona
    By Mona on 30 September, 2010

    Nice plugin… Do you also redirect affiliate URLs in the body of a post?

    Youre blog doesn’t utilize affiliate URLs in the posts very often, but some are blogs created specifically for that purpose…

    Thanks! :->

    • Joost de Valk
      By Joost de Valk on 30 September, 2010

      Yes I do every now and then :)

  21. Bryan
    By Bryan on 29 September, 2010

    Your robots.txt for yoast seems surprisingly simple?

  22. Steve Warriner
    By Steve Warriner on 29 September, 2010


    Having build one blog with beaucoup plugins and the associated complications (let alone keeping them updated), I am shying away from plugins as much as possible on a new site.

    Couldn’t you accomplish the same thing by setting up a 301 (easy from c-panel), disallowing the file in robots.txt and adding it to outbound link tracking? (that plugins a keeper :)


  23. Jon
    By Jon on 29 September, 2010

    If you overuse (80%-100% of your outbound links) 301/302 links (even using nofollow tags and that trick in robots.txt) Google will penalize you, believe me.
    If you use this in the (let’s say) 10%-20% of the total of your outbound links, it works good in my opinion.
    Good article!

    • Craig Mullins
      By Craig Mullins on 1 October, 2010

      I agree 100%… At least right now… Had HUGE drops in traffic nofollowing most of my outbound links

  24. Stephen Cronin
    By Stephen Cronin on 29 September, 2010

    Hi Joost,

    Nice post – I think I’ll try Nathan’s plugin out.

    As a co-incidence, someone pointed me to Pretty Link today (which does a whole lot more) than Simple URLs. Too much more as it happens, because it turns out the author had to remove the cloaking functionality 5 days ago due to a purge of cloaking plugins from the repository. Go figure…

    • Joost de Valk
      By Joost de Valk on 29 September, 2010

      Hehehe well that’s the kind of stuff I don’t share if I build it at all ;)

  25. Thomas
    By Thomas on 29 September, 2010


    I’ve been using Pretty Link for affiliate links. I use 301 redirects and then add rel=”nofollow” to the end of them. Does this accomplish the same thing as the robots.txt file mods?

    • Joost de Valk
      By Joost de Valk on 29 September, 2010

      I’d do both if you want to be 100% sure… I don’t nofollow them though as it doesn’t make sense, the robots.txt-ing out is a bit more secure…

      • Thomas
        By Thomas on 29 September, 2010

        I’ll get to editing the robots.txt file then. Thanks for the input!

  26. Tunji
    By Tunji on 29 September, 2010

    Wondering now how Godley’s Redirection Plugin can accomplish the same things, or whether there is some benefits to this new plugin. Thoughts on comparing these two plugins?

    • Joost de Valk
      By Joost de Valk on 29 September, 2010

      I used to ALWAYS use redirection. It however, breaks my site all the time since 3.0 came out. Hence me now slowly switching to this one…

      • Alex
        By Alex on 30 September, 2010

        Hi Joost,

        In what way does Redirection break your 3.0 site?


        • Joost de Valk
          By Joost de Valk on 30 September, 2010

          It generates a redirect from / (so the homepage) to the new post every time I publish a new post if I have it check for modified slugs…

          • Graham Stoney
            By Graham Stoney on 6 October, 2010

            Monitoring for modified posts is the reason I use Redirection; like you say, there are other options if all you want to do is redirect affiliate links. I installed a hack in the interim until the author fixed it. I haven’t had any trouble since; is it only “partly” fixed for you?

          • Graham Stoney
            By Graham Stoney on 4 October, 2010

            I hit this too a while back, and came across a patch to fix it. It is said to be fixed in the recent redirection 2.2.29. Cheers, Graham

          • Joost de Valk
            By Joost de Valk on 4 October, 2010

            It was partly fixed, and the other fix was to disable the monitoring for modified posts checkbox, now it doesn’t seem to break my blog anymore.

      • Tunji
        By Tunji on 29 September, 2010

        I have noticed lately a couple of “odd” behaviors with the Redirection Plugin (though not “breaking” my 3.0 mult-site install). Ugh, what a chore to switch all my redirects to a new plugin!

        • Joost de Valk
          By Joost de Valk on 29 September, 2010

          I know, trying to get Nathan to do an importer ;)

Check out our must read articles about Analytics