Randy A Brown

Creating Amazon Affiliate Links in WordPress

April 14, 2015
Reading Time: 12 minutes

Creating Amazon Affiliate Links in WordPress

We’ve all seen Amazon affiliate links. They’re everywhere. Sometimes they have pictures of products and sometimes they’re just a string of blue underlined text that looks like we should click on them. When we do, it takes us to Amazon. When we buy something through this link, the person who owns the link gets a portion of the sell. You can easily add Amazon links to your own WordPress website.

Amazon link pic

Being an Amazon affiliate is one of the easiest ways to make money online. You talk about products in your normal voice throughout your posts, place links on those product names, and your visitors eventually click on the links – making you money. Easy. It’s an easy way to make money because you’re not having to tend the store, making it passive income, and it only costs a little bit of time. And this is time well spent.

There are several ways to create affiliate links to products on Amazon. Amazon provides an easy way to make them, but sometimes we want to use a link differently than Amazon intends. For example, maybe you want a clickable image or more than one string of text. You can do that from Amazon too, but you don’t always want to go back to Amazon and get the link everytime you want a different string of text.

Also, if you’re like me you like to type in Word and then copy your text to WordPress. Amazon iframes and Word do not get along. I did this once and it killed all of my posts. It could be fixed by now, but I’m not about to try it and see. There’s an easier way.

This tutorial will show you how to get the part of the code that you want from Amazon, and then you can use it on any text or photo in your WordPress posts that you want. All you need is an Amazon affiliate account and WordPress. We will also look at some simple solutions that do the work for you.

Creating the Link Manually

Go to the Amazon product page that you want to create a link for. Make sure that you have your affilate account set up and you’re logged in. You’ll see a toolbar across the top of the screen that has your affilaite tools.

Select Link to this page:

link to this page

This gives you a popup that has several options for creating the link.

get html

The first is Text and Image. This will give you the standard Amazon link that we all recognize – the box with an image of the product and a link to Amazon. You simply copy the code and paste it into your content. This works great, but you have very little control over the link. You can choose the colors for the background, title, and price, and you can choose to open in a new window and whether or not to display a border. The HTML code is an iFrame that you paste into your content.

The next one is Text Only. This one lets you type in a string of text that you want your link to say and then you can copy and paste the code into your content. You can make the text say anything you want it to, but if you want to change it you have to go back to the link page and create a new link or you have to modify the HTML code manually.

Next is Image Only. This just gives you a picture of the product. You can choose for the picture to be small, medium, or large. This gives you the same type of HTML as the first option and you copy and paste it into your content.

There is another option that I use more than the others. I like to copy only the link itself. This lets me create a custom link that I can use any way I want. I can place the link over any string of text and over any image.

Creating a Custom Link and Placing it Over Text

Select Text Only and highlight the portion within the quotation marks and copy the text.

text only

After you have your content in the visual editor, you will copy and paste the code over the text and images that you want to have links.

For example, in my content I’ve written the text I want:

There is a book about blogging with WordPress called WordPress for Dummies.

Next, highlight the text that you want to make linkable, right click, and select insert/edit link in your visual editor.

text only 2

Then paste the link into the URL field, check Open link in a new window/tab, and select Add Link.

text only 3

Now the text contains a hyperlink with an affiliate link embedded into it:

There is a book about blogging with WordPress called WordPress for Dummies.

You can place this same link over any text or image that you want. It also works in email, forums, or anywhere that allows you to place a link on a string of text.

Placing Custom Links on Images

You can use the same link for images. Simply highlight the image that you want to make linkable and select Insert/Edit Link in the visual editor and paste the link the same way as you would for text.

images

An alternate method is to select the image and choose the Edit button that appears above the image.

images 2

In this screen select Custom URL in the Link To drop-down box and paste the link in the field that appears. Next select Update and you’re done. Using this method you can make any image link to anything you want.

Placing links on Images

Better Links

There are several problems with using this type of link. For one, they’re long and ugly. For another, you have no way to knowing which of your links someone clicked on. This is terrible for analytics. Both of these problems can be fixed by using a URL shortener. Here’s a quick look at several methods of shortening your URL’s and tracking them within your social media and email campaigns.

Bitly

Bitly

To make your links shorter and prettier you can use a free online service like Bitly.

Bitly 2

Simply paste in your link and hit the Shorten button. You then get a much shorter and prettier link that you can then use in place of the longer and uglier links. You can test the link by pasting it into your address bar and watch the link resolve back to its original form, complete with your affiliate information. This works just fine if you just want a shorter link, but if you want more than one link so you can track analytics then you’ll need to purchase an account. You have to contact them for pricing.

Add Bitly to Your Theme for Automatic Shortening

It is possible to add Bitly directly into your theme so that your links will be shortened automatically. Using the online method, you have to copy and paste from Amazon into Bitly, and then copy and paste from Bitly into WordPress. Adding Bitly to your theme saves a lot of time because you only copy and paste your link once from Amazon to WordPress and your links are automatically shortened. Let’s look at the code from wpbiginner.com.

First, get your Bitly API key. Once you have it, place this code within your theme’s functions.php file.

[code type=”php”]
<?php
/* Based on code from David Walsh – http://davidwalsh.name/bitly-php */
function make_bitly_url($url,$format = ‘xml’,$version = ‘2.0.1’)
{
//Set up account info
$bitly_login = ‘YOUR LOGIN HERE’;
$bitly_api = ‘YOUR API KEY HERE’;
//create the URL
$bitly = ‘http://api.bit.ly/shorten?version=’.$version.’&longUrl=’.urlencode($url).’&login=’.$bitly_login.’&apiKey=’.$bitly_api.’&format=’.$format;
//get the url
$response = file_get_contents($bitly);
//parse depending on desired format
if(strtolower($format) == ‘json’)
{
$json = @json_decode($response,true);
return $json[‘results’][$url][‘shortUrl’];
}
else //For XML
{
$xml = simplexml_load_string($response);
return ‘http://bit.ly/’.$xml->results->nodeKeyVal->hash;
}
}
?>
[/code]

Next, paste this code under the start of your loop:

[code type=”php”]
<?php
//Check for post’s shortened URL. Used with twitter feedback.
if(get_post_meta($post->ID, “short_url”, true) != “”){
//Short URL already exists, pull from post meta
$short_url = get_post_meta($post->ID, “short_url”, true);
}else{
//No short URL has been made yet
$full_url = the_permalink();
$short_url = make_bitly_url($full_url);
//Save generated short url for future views
add_post_meta($post->ID, ‘short_url’, $short_url, true);
}
?>
[/code]

Next, place this code inside the loop:

[code type=”php”]
<?php echo $short_url; ?>
[/code]

Now it will display the shortened URL even though you’ve pasted in the longer URL. It will actually shorten all of your URL’s – not just your affiliate links. This code might not be compatible with all themes, so make sure you have a recent backup first.

WP Bitly

WP Bitly

Another option is to use a plugin that will automatically shorten your links. While Bitly has an official plugin for this, it has a lower rating, hasn’t been updated in two years, and has caused some serious problems for those that have tried it in the past year. I recommend WP Bitly instead.

You just paste in your Bitly OAuth token, choose the post types (post, page, attachment, project, and Amazon auto links), and forget about it. Your links will now be automatically shortened using Bitly.

Google URL Builder

Google URL Builder

Rather than paying extra just to be able to track your campaigns you can use Google’s URL Builder. There are several great reasons to use Google’s URL Builder:

  • Shortened URL’s are difficult to track in Google Analytics
  • Google Analytics is better than any shortening service’s analytics
  • Google Analytics is free

By adding tags and parameters to your URL’s, Google will tell you which of your links are the most effective. Once you learn how to create the links it will only take a few seconds to make one. You can even add it to your website using a plugin.

Google URL Builder

Google URL Builder plugin

This free plugin brings the same tools to your WordPress dashboard. You don’t have to go offsite to get your links, but since you either have to have two tabs open (one for your post and the other for Google URL Builder), or constantly go back and forth between your post and Google URL Builder in the same window, it’s really no advantage to have it as a plugin. It would be more useful if it added the tools to your visual editor. Still, it’s there and easy to get to. The plugin works great.

Letting Plugins Create the Affiliate Links For You

I like using the manual method because I like the control that it gives me over the links. However, it does take a lot of time when you have a lot of links. There is an easier way. You can use plugins that create the links for you. Some will insert them automatically while others are more manual.

Amazon Link

Amazon Link

This free plugin will let you quickly make text links, thumbnail images, full-size images, flash widgets, and more. You place the links within your pages, posts, and widget with shortcodes. It has a built-in search tool to help you find items to post. It has templates for buttons, banners, MP3 clips, etc. It has 8 expansions that add extra functionality to the plugin that includes functions such as redirect, stylesheet, translate, and more.

This is an easy plugin to set up and use. You choose your default country, enter your Amazon affiliate ID and keys, and you’re good to go. It’s not automatic, so you’ll have to search for products and create the links within the plugin using the Amazon ASIN. Once you have the links, you just insert the shortcodes. It’s easy to use. The extensions are interesting too.

Amazon Product in a Post Plugin

Amazon Product in a Post Plugin

This free plugin lets you place items within your posts, pages, and widgets with shortcodes. The shortcodes are simple to use. You just input the Amazon ASIN: [AMAZONPRODUCTS asin=” XXXXXXXXXX”]. You can also use extra parameters with the shortcodes to show more detail, show multiple products, etc.

It adds something called Amazon Product Post. This is a post for the Amazon product. It has similar feature to a regular post, with text (with no editing features), categories, title, and status. It lets you choose what type of post it will be (post, page, project, etc.), lets you insert the Amazon ASIN, and choose the product location. Once you’ve created the Product Post you can edit it just like any post using the visual editor.

It gives you more help than most plugins. It takes you step by step through getting your Amazon access keys to help get you started. It gives you plenty of examples of using the shortcodes. You can place the products above, below, or within the content.

It’s easy enough to use and has a lot of features. The shortcodes have a lot of examples and I like that you can modify them.

Amazon Auto Links

Amazon Auto Links

This free plugin gives you full control over your Amazon links. You can place your links within pages and posts using a shortcode, and it has its very own built-in widget for your sidebars. You choose where within your posts you want the ads to appear. You can create your own templates and has two built in.  You can also place your ads within your theme. You can blacklist or whitelist products. You can shuffle the products by random, title, or date. You can show images from thumbnail size and up to 500 pixels.

It works without JavaScript, so your visitors will still see them even if they’ve turned JavaScript off within their browser. It supports all Amazon locales and chooses the correct one based on your visitor’s location.

It does have the most features of the plugins discussed here, but it also has a lot to set up and little bit of a learning curve. It has good examples for setting everything up, using the shortcodes, and creating your own templates.

VigLink

VigLink

To be honest, I find most affiliate links within the text to be annoying. They usually have annoying popup’s that slows my connection down (I live out in the country and my family shares a 3G connection). My mouse cursor always finds them. They aggravate me and I will never click on them.

Fortunately, there are better ways to do this. You can get a plugin that will provide affiliate links within the text of your content and not be aggravating with those annoying popups. One such plugin is VigLink.

This one searches through your content and places links within your text on relevant words. It makes connections between publishers and advertisers. Advertisers bid for the links, making sure that you get the best return for every link. You can also use the links in your social media and email campaigns. VigLink even shortens them.

Advertisers include the big name brands like Nike, Adidas, Puma, eBay, Apple, Samsung, Amazon, and the list goes on. There are enough brands and advertisers that you’ll get good links no matter what your topic. This is a good choice if you want more than just Amazon.

VigLink 2

You have full control over how many links you have and the types of links. You can have just text, or you can have a spotlight (an ad within your content), and you can have it to re-affiliate your affiliate links (so it will fix any issues). It will also automatically place URLs anywhere you have a web-address without it being an active link. All of this is adjustable. There is a detailed dashboard where you can see your sales and makes changes.

VigLink 3

The only downside is that you’re sharing your commissions with VigLink. However, you also have access to more advertisers and all you have to do is produce your content, and the links are placed for you. You can set it and forget it and still make money from your website. In my opinion this is a good trade-off. They even have a referral program. Score.

Tips

Don’t use product names just to make an affiliate link. This will be seen as spammy and is a turn-off to your readers. Give them good content – content that works great without the links and then when you add your links they won’t feel out of place.

Don’t overdo it on the links. Your site would be perceived as being focused more on monetization than producing content.

Inform your readers that you make commission from your links. You readers won’t feel like you’re using them and they might see this as a way they can pay you back for all the valuable content you’ve given them.

If you use plugins to create the links, make sure they’re not annoying to your readers. There is enough competition out there that they will find another site that doesn’t annoy them as much.

Check your website’s speed often to make sure the plugins are not slowing your site down. There are several good speed testing sites including Google PageSpeed Insights and GTmetrix.

Use tags with shortened links so you can track them.

Use analytics and learn which placements work best and delete the rest. A few well-placed links is better than a bunch of poorly-placed links and your website will look and feel better, and your readers will appreciate it.

I’ve talked a lot about plugins in this article. For an interesting article about essential plugins see the The Best WordPress Plugins Recommended by The Experts

Final Thoughts

Adding Amazon links to your WordPress website is fairly straightforward. There are several ways to do it and each method has advantages and disadvantages. Whether you use one or all of the manual methods, or use a plugin to handle the links for you, adding your own Amazon affiliate links to your website is a great way to make some extra cash and it gives your readers a way to reward you for all of the hard work you put into the content you give them. Your readers are going to Amazon anyway – they might as well go through your links.

Your turn! Do you use Amazon affiliate links on your website? Do you use one of the methods I discussed here or do you use a different method? I’d like to hear your thoughts in the comments below!

4 Comments

  1. Linnea

    There sure are a lot of ways to add Amazon affiliate links! I’ve just been doing it manually. Now that I have a website with thousands of links, the challenge has been how to check to see if all of the links still point to in-stock products. To solve this problem I wrote a WordPress plugin called Check Amazon Links that searches your site’s Amazon links and generates a report of which products are out-of-stock so that you can update them. It also tells you which links have affiliate tags on them incase you forgot to add your tag to some of the links.

    The catch is that it won’t work with link shorteners. But my plugin is free and does work for finding regular Amazon links, and also Amazon iframe links. Anyway, my plugin is pretty new so I thought it would be worth mentioning it. I’m still working on ways to improve it.

    Reply
  2. Ikomrad

    Is there a way to just paste the HTML code that Amazon gives you into the page? I’m using the Visual editor and don’t see a way to insert HTML. Also, the other view I have is “Text” , but no “HTML” view is available in the editor.

    help!

    Reply
    • Randy A Brown

      You can paste the code. Amazon now provides links to get the text, image, or text and image. Copy the one you want and paste it on its own line. You’re right about the Text tab. “Text” in the WordPress editor is the HTML editor. Switch to the Text tab and paste the code.

      Reply
  3. Denna Stephens

    I’ve tried the plug in steps, but will not work unless I upgrade to the business account.

    Reply

Submit a Comment

Your email address will not be published. Required fields are marked *

Book Review: Guitars by Brad Trivett

Book Review: Guitars by Brad Trivett

Guitars is an excellent book about guitars. It works well as a buyer’s guide, but it also includes lots of information about the history of the guitar, guitar...