One Link To Rule Them All: The Canonical URL and You
August 16th, 2012 by
“I will take the Link,” [Frodo] said, “though I do not know the way.”
When the Internet was a wild frontier in the ’90s, URLs appeared to me magical glyphs that television advertisers and producers revealed only to the worthy. What secrets would be revealed if I, a ten year-old, borrowed my aunt’s computer to type in “trojan condoms” as the commercial on MTV requested? What hidden jokes would I learn if that same “net surf sesh” eventually took me to “http://comcentral.com/“, the URL appearing in the end credits of Dr. Katz?
Luckily, my youthful precociousness was maintained as I never visited the former, but for a time, the latter URL stuck out in my mind as an oddity. Where was the www in that URL? Did I need to type in the http:// portion? Shouldn’t their website be at http://www.comedycentral.com/ since it’s, you know, the channel’s name? Also, why the heck are two websites I’m visiting the same thing?
To this day, visiting http://comcentral.com/ will redirect you to the logical URL for their branding. In terms germane to our company, http://www.comedycentral.com/ is the canonical URL for Comedy Central, or the TRUE URL that Comedy Central wants you to access their site by.
Multiple benefits exist for canonizing a URL, especially in relation to Google’s Analytics and Webmaster Tools. A preferred domain can be set, and data will be formatted to represent the canonical URL. If an accessed subdomain on a site (For example, http://www.xyz.com) presents the exact same content as the domain alone (http://xyz.com/), but each URL exists on its own without redirects, it’s important to canonize one of the two by setting up 301 redirects.
In relation to the Google tools mentioned above, you might miss out on potential data related to traffic unless you set a preferred domain and ensure that it’s the exact URL served up to site visitors. If a Webmaster Tools account is setup for http://www.xyz.com/ but not http://xyz.com, incoming links for http://xyz.com/ will not be tracked in Webmaster Tools. This is because the www version is treated as a subdomain, and is therefore a different site in the same way that http://mail.google.com/ differs from http://www.google.com/. As the horse says above, setting a preferred domain in Webmaster Tools and setting up a 301 redirect will allow incoming links for either version of the site to appear.
Another problem averted by setting a canonical URL popped up in a task I received recently. Google Analytics has a neat “In-Page Analytics” feature that provides some interesting metrics on user behavior directly on your site. My task was to determine why this wasn’t working for the client. The error message provided basically asked me to verify that the tracking code was installed on the page, and I found that it was. Digging further, I found that setting the “Website URL” in Analytics to the proper canonical URL (which didn’t have the “www” in it as was set in Analytics) cleared up that issue, and we could see the compiled user data on the In-Page Analytics viewer.
In general, consistency in the presentation of a website is good practice, be it in a site’s graphical layout, or, as this blog post dances around, in sitewide URL structure. It’s commonly known, but setting your URLs up in a clean, uniformed fashion may result in a smile of good fortune from Old Man Google for your humble homestead in this cyber frontier.