Posts Tagged ‘hide commission junction links in wordpress’

How To Hide Your Affiliate Links In WordPress

There are a variety of reasons why someone would want to hide/cloak their affiliate links.  I found all kinds of expensive software to do it, but I wanted a free method.  I could use PHP, but I didn’t want to leave my WordPress dashboard, go make a php page and then upload it to my server.  So I McGyver’d it and came up with my own method using a couple of plugins.  Don’t laugh, it works.  Even for Commission Junction.

Here’s how to easily hide your affiliate links in WordPress…for free.  This works for HTML links, not Javascript.

Plugin(s) You’ll Need

  1. Exclude Pages  (only if you want to keep the redirect page out of menus and widgets)
  2. Redirect  UPADATE:  Since writing this post, I’ve switched to Quick Page/Post Redirect.  It has more control.

Other Considerations

My permalinks use /%postname%/ so my keyword laden titles become the page name instead of that lame p=123 format.  BEFORE you go changing your permalink structure and pissing off the search engines with a bunch of borken links, not to mention, losing your page rank, install Dean’s Permalink Migration plugin.  THEN, go into Settings > Permalinks > Custom and enter /%postname%/  (Make sure you have both the preceeding and trailing slash and percent signs).  Dean’s plugin will create 301 redirects to the new page when you change the permalink structure so your pages and posts still work and you won’t lose face with the search engines..

Install and activate the plugins.

  1. Add a new a Page, not a Post.
  2. Enter a short page title.  The title will become your new affiliate URL.  Say you’re selling bananas.  Enter:  bananas, or get bananas, or buy bananas, or go bananas.  If you want, you can create a parent page like go, recommends, get, etc. and then create your affiliate redirect page as a child page of the parent page.  Depends on how anal you are about organizing things.  On a big site, it’s good to have your redirects all in one spot.
  3. Exclude the page from the menu by unchecking the checkbox on ‘Include this page on user menus’.  Same thing goes for the parent page if you’re making a child page.  If you don’t, the page will appear any place other pages display like in menus or widgets.  If you want it to show up in those places, then leave it checked or don’t install the Exclude Pages plugin to begin with, but I always do.

There are two different style of affiliate links…

  • Simple URLs with an affiliate ID, page, or sub-directory, depending on how they structure it, or
  • Snippets of code like Commission Junction with a URL and/or some type of image such as a 1×1 pixel tracking image for text links, or a banner.  If it’s a text link it will also have anchor text.

Simple Affiliate URL’s

  1. While still in the Page editor, in the Custom Fields (just below the page editor), create a new custom field.
  2. Name:  redirect.   (Fields you’ve already used will appear in the list box.)
  3. Value:  paste your affiliate URL in here, too, BUT NOT for Commission Junction or other affiliate code that includes an banner or pixel tracking image.  Here’s how you do that…Affiliate URL redirect
  4. Now click the Add Custom Field button to add it to the page.
  5. When you’re done, click Publish.
  6. Now copy the URL from the page you just created.  You should see it displayed in the Permalink right under the title, just above the editor’s toolbar.  This is the URL you will use INSTEAD of your affiliate link.
  7. Here’s how to call the new redirect page for simple anchor text.  Any place in a post or page where you want to use your affiliate link for anchor text, just call your redirect page and have it open a new window, if you like.  Like this:

Redirect usage

That’s it.  Now lets set up the more complex Commission Junction page.

Commission Junction Links or Affiliate Code With a Banner or Pixel Tracking (1×1 image) 

  1. In the Page editor, click the HTML tab and paste your CJ code into the editor.  We’ll use this as a temporary workspace and we’ll do it in HTML mode so we don’t introduce goofball characters.
    Copy the CJ URL
  2. Looking at the image above with the yellow highlighting, copy EVERYTHING between the first set of double-quotes from the HREF anchor tag, but NOT the quotation marks.  (You will not have an SID if you’re not doing any tracking.) 
  3. Now paste what you copied into the Value field for Custom Links.  So your Custom Fields redirect should look like this:Add Redirect
  4. Now click the Add Custom Field button to add it to the page.
  5. When you’re done, click Publish.
  6. Now copy the URL from the page you just created.  You should see it displayed in the Permalink right under the title, just above the editor’s toolbar.  This is the URL you will use INSTEAD of your affiliate link.
  7. In the HTML editor where you pasted the original CJ code, replace the HREF anchor value with your new affiliate redirect page like shown in the image below, leaving the rest of the code alone so it can display, but most importantly, still track properly.
    CJ banner
  8. After you setup everything above, copy the new Commission Junction code into your sidebar widget or drop it where you want it to display in your posts and pages in HTML mode.
  9. Go back and remove the CJ code from the HTML editor area and republish.  Leaving it there won’t break anything, but it will inflate your CJ impression stats because the image it will cause it to track a second time when that redirect page is called.

Don’t forget to test it to make sure it goes to the merchant’s site.

About that little 1×1 pixel tracking code

If after you insert a CJ text link and you see that little 1×1 pixel even though it says border=”0″, it could be because of your theme.  Here is a slick way around that.  I stole it from Amazon’s affiliate text links.

Replace the:  border=”0″

With this:  border=”0″ style=”border:none !important; margin:0px !important;”

Then any border around that pixel image will vanish.

 
SuperGreen Hosting - Blazing Fast Hosting For Your WordPress BlogsRun WordPress At Blazing Fast Speeds - Reliable, affordable SuperGreen Hosting offers unlimited disk space & data transfer for only pennies a month. Free instant setup. Free domain name. World class carbon-neutral data center.

Share
Artisteer - Wordpress Theme Generator
Archives
Blog Theme Generator

Artisteer - #1 Blog Theme & Web Template Generator

Get Free Traffic

Blazing fast WordPress hosting. Host unlimited sites on unlimited hosting space. Free domain & setup. Only $3.95/mo.