Cloaking an affiliate link

One of the topics we haven't really touched on is affiliate marketing. You don't have to sell just your products. You can use WooCommerce to create product pages for other people's products as well and link them to a site where you have an affiliate deal. You could be recommending related products or you could have an entire store that's nothing but affiliate products.

To track affiliate traffic, the site owner will usually give you a special link that you have to use. Sometimes, they look pretty normal; for example, http://mywebsite.com/?ref=25.

And some other times, they look pretty scary; for example, http://shareasale.com/?referrer=4234242342&target=243534534543&otherboringdata=23424234234.

When the links don't look pretty, some users may get scared off. So you can set up a special URL on your site that points to the affiliate URL. On your site, you'll use the pretty link, and that will take the user to the affiliate URL. This is called link cloaking.

How to do it...

For this example, I'll be creating a link on my site that will take the user to an affiliate URL. Let's take a look at the following steps:

  1. In the WordPress admin, click on the Plugins menu and then on Add New.
  2. Run a search for the Redirection plugin.
  3. Install and activate the plugin.

    The Redirection plugin is a very useful plugin for changing any links on your site. If you have links that point to a page that no longer exists, you can create a redirect to take the user to a more useful page. You can use this same functionality for affiliate links.

  4. From the WordPress admin, go to Tools | Redirection.
  5. You should see a list of redirections (it should be empty) as well as a place to enter new ones:
    How to do it...
  6. Enter the pretty URL that you want your customers to see in the Source URL field.

    Note

    Rather than typing in http://mysite.com/affiliate-name/, you may just type in /affiliate-name/.

  7. Enter the ugly affiliate URL in the Target URL field.
  8. You can leave the other fields as they are.
  9. Click on Add Redirection.
  10. Test your link to make sure it works.

There's more...

This is only the very beginning of link cloaking and affiliate marketing. In the next recipe, we'll use regular expressions to create a pretty affiliate link pattern.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset