URLs, social media and campaign tracking

Canonicalizing URLs is a very important  aspect of Search Engine Optimization but also of Social Media Marketing. This morning, when checking my feeds, I noticed an example that I thought could help you understand the what and the why of it. What I noticed was this: Smashing Magazine had put out one of their usually very popular “100 … WordPress themes” posts. This time called: 100 Free High Quality WordPress Themes: 2010 Edition. Now, don’t get me wrong, there’s absolutely nothing wrong with that post.

There is something wrong however, with how this post is being treated by several social networks. First of all, there’s Delicious. Check out this search; it’ll show you Delicious has 12 different URLs for the same post. While the proper URL for the post has the most bookmarks, as much as 15% of all the bookmarks are for “wrong” versions of the URL. This means that the post could, in later searches on Delicious, do 15% better if the URL had been canonicalized / standardized properly, in other words, if all this stuff had been redirected to the proper URL.

Those wrong URLs are basically divided in 2 groups: StumbleUpon “framed” URLs and FeedBurner or otherwise “campaign tagged” URLs. Let’s go through these groups one by one, and see if we can solve this.

StumbleUpon framed URLs

I very much dislike the fact that Delicious doesn’t understand these URLs. Delicious should be able to “stab” through a URL like that, and then bookmark the proper URL. But I also actually dislike the way StumbleUpon puts a frame around URLs. Somehow, when Digg did this, it created an outrage, but if StumbleUpon does it, it’s fine. Now their goals might be different, but I still dislike it. The “rough” solution is simple: add a frame breaker to your blog:

<script type="text/javascript">
if (top !== self) top.location.href = self.location.href;
</script>

The issue is that doing this would prevent people from voting up your site on Stumble, something you might actually want to happen. The second solution is adding a visible delicious button to your site so people can bookmark the post through that button, using the proper version of the URL. It’s not as safe, but it might work for a part of the group that made the wrong bookmarks in the first place.

Google Campaign tagged URLs

These are the URLs that annoy me most. FeedBurner has the quite awesome option to campaign tag your posts, which means that it’ll add variables to your URLs like this:

?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+SmashingMagazine

Those give some awesome insight into where your readers come from, and it’s a feature I’d hate to miss. However there’s one issue with it, and it’s in the very first part of that string: it’s the question mark. The question mark has a real meaning in URLs: it allows you to add parameters to a URL. For that reason Google and other search engines, as well as sites like Delicious, can’t automatically strip these off. There is, however, a very nice solution to this problem: campaign tracking using a hashtag.

This requires you to use the setAllowAnchor() function within your tracking code. After you’ve added that to your tracking code, you can now use #utm_source instead of ?utm_source, and suddenly the world looks much cleaner and nicer. Of course there’s a small issue left: FeedBurner still uses the question mark based tracking. This is fixed by redirecting the question mark based campaign tagger URLs to the hash tag based ones.

This may all seem a bit daunting, but I’ve got some good news: if you use my Google Analytics for WordPress plugin, all you have to do is check a box under the advanced settings:

It will then automatically add the needed code and redirect all campaign URLs. Just another step towards a better optimized site, as this should prevent sites like delicious from bookmarking the wrong URL.

Tags:


Yoast.com runs on the Genesis Framework

Genesis theme frameworkThe Genesis Framework empowers you to quickly and easily build incredible websites with WordPress. Whether you're a novice or advanced developer, Genesis provides you with the secure and search-engine-optimized foundation that takes WordPress to places you never thought it could go.

Read our Genesis review or get Genesis now!

17 Responses

  1. John HoffBy John Hoff on 20 August, 2010

    Nice catch on that Delicious page.

    Too bad there wasn’t a .htaccess code which could redirect all those links properly (except the Feedburner one of course).

  2. materialsdaveBy materialsdave on 20 August, 2010

    Thanks for the tip — I just activated it and will see what happens.

    You probably could write an explanatory post for each of the advanced features in your GA plugin!

  3. RarstBy Rarst on 20 August, 2010

    I almost made a mess with URL tags recently. I just ticked option in FeedBurner to add them… Then feed is used for tweets… And suddenly I notice my Google Custom Search (as well as regular Google) give multiple links to same recent posts.

    I had canonical tags at pages bu neither that or using “query parameters to ignore” (or something like that) in Google webmaster tools didn’t fix it.

    Glad I caught it right away at least. It’s weird when two major Google products can be that bad at working together (another recent example is Google Analytics tracking Custom Search and adding Google’s cache pages in there because it is same query parameter).

  4. JamesBy James on 20 August, 2010

    Nice tips – but please stop abusing apostrophes.

    • Joost de ValkBy Joost de Valk on 20 August, 2010

      Where am I abusing them? :) Though my english is reasonably OK, I’m no native, but happy to learn :)

      • JamesBy James on 20 August, 2010

        On each occasion where you pluralise “URL”. Apostrophes are used to denote either a missing character or to show that something is possessive – never in plurals (except where it’s a possessive plural, where the apostrophe is the last character).

        No apostrophe:
        There are many URLs – correct (plural);

        Apostrophe:
        This URL’s badly formatted – correct (missing “i”);
        These URLs’ destinations are interesting – correct (possessive plural).

        :o)

        • JamesBy James on 20 August, 2010

          That’s probably not the best explanation ever, though – I’m sure you can find better with Google… ;o)

        • Joost de ValkBy Joost de Valk on 20 August, 2010

          fixed, thanks :)

    • KarenBy Karen on 21 August, 2010

      James, your observation is correct, but I’d like to suggest that you send such an off-topic (and potentially embarrassing) comment as you’ve posted here to Joost, by way of a private contact message instead! :)

  5. JamesBy James on 20 August, 2010

    You’re welcome. :o)

  6. Thomas ScholzBy Thomas Scholz on 20 August, 2010

    Since I don’t use Feedburner, and Twitter is adding such tracking parameters too, I build my own rewrite rule to redirect those URLs to the canonical version:

    # Catch obstrusive tracking parameters like ...
    # ?utm_source=twitterfeed&utm_medium=twitter or
    # ?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed:+wdrss+(WDRSS)
    # ... because they generate doubled content.
    RewriteCond %{QUERY_STRING} utm_source= [NC,OR]
    # Some people put their own URIs into this parameter. May be better banned.
    RewriteCond %{QUERY_STRING} ^p=\D
    # The question mark removes the query string.
    RewriteRule (.*) /$1? [L,R=301]
  7. Jesse McFarlaneBy Jesse McFarlane on 20 August, 2010

    I was wondering what that radiobox was for in your Analytics plugin. Lovely explanation and fix, and I have to agree about StumbleUpon frames and Delicious not drilling down properly. Two great tools that are somewhat lacking in elegance. They both could really use something like Facebook’s OpenGraph, as much as I hate to say it.

  8. Todd S JonesBy Todd S Jones on 20 August, 2010

    Great info, thanks!

  9. saniaBy sania on 21 August, 2010

    Thanks for Such a Nice info for my Blog…

  10. Paul AnthonyBy Paul Anthony on 22 August, 2010

    I’ve implemented frame breakouts before on my own site before later removing it. The reason? There’s just too many services out there with the social voting mechanism built into a frame. Wrong? Yes. Should we try and correct it, and potentially cut off our nose to spite our face? Not in my opinion.

    Screw with the visitors actions (i.e. the natural stumbleupon process of stumbling through the web) or using such a service, and the chance for a social vote diminishes rapidly. Delicious as you’ve stated, should be detecting framed content and utm params, and sorting it out themselves.

  11. Fran CivileBy Fran Civile on 25 August, 2010

    I want to compliment for accepting a public scolding so graciously Joost … You saw
    the opportunity to learn something and took it,a sensible choice but not everyone’s first reaction.

    James meant well and was probably not aware that english is not your first language
    because you handle it extremely well!

    Fran :)

Trackbacks