Better Links & Better Links Pro

I haven’t been writing as much lately because I’ve been hard at work building new products for the customers over at BoostWP. In the last two months we’ve released two awesome new products and I wanted to take the opportunity to talk a little bit about one of them today, including benefits it brings our customers, the ways in which it compares to a similar product, and the technical challenges I faced during implementation.

Better Links – a feature complete, free plugin for everyone

There are a variety of link shortening plugins on the market, with the 800 pound gorilla in the room being Pretty Link and its paid add-on, Pretty Link Pro. It was obvious there was demand for a high-quality product in the space and I saw some pretty immediate deficiencies in Pretty Link, so Better Links was born.

Better Links – what is it and why is it valuable?

Better Links, which you can download for free from the WordPress plugin repository, has all the standard features you’d expect from a link shortening plugin. The most important, of course, is the ability to define a redirect to a specified URL from a specific suffix on your WordPress installation’s site URL.

What does this mean? Well, essentially you can tell Better Links that any time someone visits they should be redirected to immediately and it just works. Here’s how that looks in the plugin:

Better Links Core - Edit Link

It looks so easy, right? I guess the next question is, why in the world would you want to do this? There are a couple of important use cases for Better Links (or other link shorteners).

First, you can change the destination URL for this particular link at any point in the future, even after you’ve used it in post or page (or other, I suppose) content. If I change my mind in the future about what the best Black Library book is (perhaps to something like the Salamanders Omnibus), then I can update the destination once and all my links automatically point to the right place.

Second, you can make your URLs cleaner for your site’s visitors. Some URLs (like the Amazon one I showed above) are fairly messy, containing a lot of extraneous information and query arguments. This can scare some visitors to your site away from clicking on links; this is especially true for affiliate or other links where a myriad of tracking information is added to an otherwise clean URL. By showing the user that they’ll be visiting instead of something with 15 query variables, they’ll be more likely to click on it.

Third, you can easily specify a link once and then use it in your site’s content without having to remember some long, complicated URL each time. Better Links makes it easy to insert links as long as you have some idea what you’re looking for. How? Well, let me show you:

That’s it! You can also search for your links by name or slug once you have more than can be shown on one page. You can insert your links using a shortcode (which guarantees appropriate linking and tracking) or you can insert “raw” where a simple a tag is inserted into the appropriate place in your content.

With the free Better Links plugin you also get some rudimentary click tracking and the ability to import your links from Pretty Link if you decide to switch over (which I wholeheartedly recommend).

Better Links – how is it better than Pretty Link?

There’s a couple of big ways that Better Links differentiates itself from Pretty Link. First, it does things the WordPress way. In Better Links, we don’t create separate database tables to hold data about your links, link categories, and clicks like Pretty Link does. We use the standard data storage structure of WordPress thoughtfully to save information the way WordPress is designed to do.

Second, (and this may be a bit of hubris, but forgive me for a moment) the interface for Better Links in all areas of operation is superior to that of Pretty Link. Compare the two side by side and think about which one you’d like to use:

Comparison of Link Adding Interfaces

Finally, Pretty Link doesn’t even offer you the ability to insert your links into your post or page content with any ease unless you upgrade to Pretty Link Pro. Better Links gives you the easy insert and editing features in the base version. I understand the reasoning behind that decision, but if I’m going to release something as FOSS, I’m not going to pull core features just to prompt someone to pay me money.

Better Links Pro – more features for the advanced user

If you’re an entrepreneur and serious about using a link shortener as a tool for your business, then you’ll probably want to take a look at Better Links Pro. Better Links Pro is an add on to the Better Links plugin that adds some features that can be useful for those looking to take their link strategies to the next level. Here’s what the insert link screen looks if you have Better Links Pro activated:


As you can probably tell, there’s a bit more there than with the base Better Links plugin – these new features are specifically targeted at use cases that our customers have identified as important to them.

Destination types

First, you’ll see there are three different ways to redirect URLs with Better Links Pro:

  1. Single destination – the same as Better Links
  2. Multiple destinations – redirects for this link (for different visitors) are split evenly between multiple URLs
  3. Geographic destinations – redirects for this link are split based on the visitor’s country (or sent to a default location if one isn’t specified for a particular country)

We already talked about the first option, but why might you want to use one of the others?

Multiple destinations

Let’s say you have multiple variations of a landing or sales page at,, and You want to drive traffic to each of them and evaluate the conversions (lead capture, sale, etc) that are realized for each variation. Obviously, you need to try to drive roughly equal traffic to each page so that you can fairly compare the results.

That’s where the multiple destinations destination type comes in. In this example, you’d specify your link as and Better Links Pro would automatically rotate new visitors through each of the variations. One important thing to note: if a user has already clicked the link and been redirected to a particular URL, they will always be redirected to that URL so a single individual doesn’t see more than one variation on accident.

Given this functionality, you’d be able to drive traffic through a single gate ( and then evaluate the results for each variation appropriately without any extra work on your end. Pretty great, right?

Geographic destinations

This is where things get really interesting! As you can see in the above screenshot, you can specify where a user should go based on their detected country. There are multiple reasons why this could be valuable. Off the top of my head, here’s two important ones:

  1. Several affiliate marketing companies allow you to specify different URLs for different countries so you can get appropriate commissions (but won’t pay commissions if the visitor goes to the wrong country affiliated site)
  2. You need to block or otherwise restrict citizens of particular countries from directly accessing content you provide (this may be because of terrorism, morality, or other statutes in those countries)

Country based redirection has long been one of the best features of EasyAzon Pro, so I was excited to use some of the same implementation techniques here.

Keyword replacement

This feature has been hugely important to many of our customers since we released Better Links Pro. Why? Because it lets our customers automatically derive new revenue from existing content on their websites. They put in a trivial amount of new work and can benefit from everything they’ve done in the past. How does that work?

Say you write a lot about hosting and you often mention various hosting companies by name in your posts: HostGator, BlueHost, WP Engine, SiteGround, etc. With Better Links Pro, each of those names can automatically be assigned a Better Link without you having to manually add links around the hosting companies’ names. That’s pretty great, right?

Better Links Pro is even smart enough to exclude links from headers if you want it to! That means you won’t have a big honking blue link right in the middle of h2 or h3 in your post content.

This is just another example of my philosophy of plugin development. Make things easier for end users by making technology do the hard work.

Advanced tracking – leveraging Google Analytics for fun and profit

The final piece of the puzzle is really where you can make a lot of money and leverage your insights to better serve your site’s visitors. Better Links Pro includes integration with Google Analytics that tracks a variety of things:

  • When is a Better Link shown on the frontend of the site?
  • Where is that Better Link located (single page / post content)?
  • How often is that Better Link clicked in that location?

Using this data, you can see which links are performing the best and where, leading to potential optimizations in terms of making link text more attractive, reusing well-performing link contexts, and more. Better Links Pro gives you the ability to dig deep and really dial in your link performance with very little extra effort on your part.

Oh, and did I mention that all this data is displayed right on your Better Link and Post edit screens? That’s right! You don’t have to head over to Google Analytics and decipher event tracking streams to get the information you want because it is all there for you to use, right in your WordPress backend.

Go buy Better Links Pro

I honestly believe that Better Links Pro is worth every penny (although I may be a tad bit biased) so I recommend you go buy it now, either as a one-time purchase or, to your benefit, as a part of a BoostWP subscription.

Better Links and Better Links Pro – some implementation challenges

On to the geeky stuff!

Building Better Links and Better Links Pro wasn’t as simple and straightforward as I had first imagined as there were a lot of edge cases that I had to capture and work around.

First, and most importantly, I had to make sure people weren’t creating and activating links that were going to conflict with existing links on their site. This meant detecting the slug that a user specified, comparing it against the existing active link slugs in the database, and saving / displaying an error to the user while disallowing activation of that link. Here’s what a user sees if they try to save a link that conflicts with another:



A similar error message is displayed if the user tries to specify an invalid destination URL (or empty destination URL) when saving a link.

Second, working with keyword replacement is tricky when you’re modifying a potentially invalid DOM and dealing with markup that is wholly unknown. I used the native PHP DOM handling functionality with a minor facade added on top to properly insert link nodes without invalidating the remainder of the structure. Doing some clever XPath detection, I was able to detect when keyword text was inside of a header tag and restrict placement there if appropriate.

Finally, working with the Google Analytics API was not the enjoyable experience I thought it would be. API responses come back as a set of dimensions and metrics “table rows” which then have to be transformed into something that is actually useful. It definitely wasn’t the hardest API integration I’ve ever done, but it was certainly an interesting one.

The future of Better Links and Better Links Pro

Right now I have some bug fixes and feature upgrades prepared and being tested for both the core Better Links plugin (again, free on the plugin repository) and Better Links Pro. I’m excited about taking the next steps with the plugin and continuing to improve it for users. If you’ve used either the base or pro version, I’d love to hear from you in the comments!

2 thoughts on “Better Links & Better Links Pro

  1. Alan

    Hi, I’ve been using Better Links Pro for a couple of years now, and it’s been great. Until just recently, when I started noticing some errors appearing in the chrome console, when investigating why my Envira gallery wasn’t working properly.
    Just wondering if the plugin needs to be updated to work properly with newer versions of WP?


Leave a Reply

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