The Problem With Social Buttons, URL Shorteners And WordPress Networks

There Can Be Only One
There Can Be Only One

I love the network features of WordPress 3. This blog is one of 11 running from a single WordPress install using the multisite feature with domain mapping.

While the feature is excellent I do have a concern when it comes to the use of URL shorteners and plugins that create short URLs for posts on creation and then send the off to places like Twitter and Facebook.

When you create a post on a network blog the original URL looks something like this:

After domain mapping kicks in this URL is changed to something like:

This is all well and and good, but all of the plugins I’ve tried that tweet out that my next epic post is available for you to drool over, shorten the URL before the domain mapping kicks in.

As a reader this behavior has no effect on your experience. The WordPress backend cleverly does a little 301 redirect to ensure you always end up at the URL I want you to be at, but it does have an effect on URL shortening services which may end up creating 2 short URLs for every page on your site.

2 short URLs by the same service that eventually end up at the same page may not sound like much of a problem but it can lead to some issues.

The most obvious problem comes when tracking clicks on 3rd party URL shorteners like You now have to track 2 urls and add the numbers to see the correct amount of traffic driven by a specific short URL.

Social buttons such as the new Twitter button and other retweet buttons can report numbers that are significantly below what they should be.

As an example, consider this post you are reading now. If it gets tweeted out automatically and the short URL is generated against the non-mapped URL, the short URL will be SHORT URL 1.

Now lets say that 15 of my followers retweet me (in the old sense – RT @pauloflaherty) and the SHORT URL 1 is included. That should, in theory, make the retweet button on this page read 15. The problem is that it won’t read that, it will read zero.

The reason for this is simple. When the retweet button is generated on the page it polls for the URL of the post and with domain mapping enable it receives the mapped URL. When it polls Twitter, (Tweetmeme or Topsy) to check how many retweets were made, it finds nothing because of the difference between the two URLs. The service providing the social button treats the second URL as a new site.

When this happens retweets are only counted on your site from when someone clicks on the retweet button on the post and using the mapped URL generates a new short URL: SHORT URL 2.

The numbers for displayed for SHORT URL 2 are going to be signifcantly reduced as they will always be minus those of SHORT URL 1.

So now that we know what the problem is, how do we go about fixing it?

The answer is rather simple yet beyond the control of the average user.

The plugin that you use to generate a short URL and tweet or Ping it out needs to be aware of the domain mapping.

Considering that the network feature relies on a plugin for domain mapping, it should be possible to check for the presence of this plugin, then poll the database to find out the domain mapping for the current blog, and adjust the URL being sent to URL shortening service accordingly.

As I said above, this is beyond the capabilities of the average WordPress user, but is something that developers need to take into consideration going forward.

If your favorite URL shortening plugin doesn’t already support this, it’s time to drop by the developers site or forum and let them know that you need this fixed (and don’t forget to donate accordingly when they do).