Working with trackable links and multilingual WordPress
One of the WordPress sites I recently developed uses the fantastic ZD Multilang plugin for WordPress to display multilingual content. This is the best plugin I’ve found so far for this but, as usual, a couple of bugs were discovered after the site launched …
This first of which involves updating the translated content: if you use IE8, it will simply wipe the data from the database instead of writing it. Bit of a pain (especially when this was discovered), but easily fixed by not using IE! Works fine in Firefox, Chrome, etc.
The second revolves around the way the language content is distinguished within the URL and how this interacts with the use of UTM codes within the querystring of Google Analytics-enabled links.
To try to make the site more SEO-friendly, I changed the default permalinks of the pages and posts from ?p=123 to /%category%/%postname%/ and set the language permalinks in the plugin settings. This puts the language indicator within the URL so that it looks like “site.com/es/category/postname”. Everything works fine until you start using querystrings.
On the most recent marketing email, UTM codes were added to the querystring on all the links back to site so that clickthroughs could be measured. The links looked like this: “site.com/en/category/postname/?utm_campaign=XXX&utm_medium=email&utm_source=YYY&utm_content=AAA&utm_term=BBB”. Through testing, it was soon discovered that, although they worked, the language switcher on the site no longer worked! Worse, pushing the Spanish links to the Spanish content on the site simply didn’t work, it would just default to English.
After much pulling of hair and gnashing of teeth, a solution was found. By simply changing the link on the email back to the default permalink and putting the language choice in the querystring, everything worked fine! The links went to the correct landing page in the correct language and the nice SEO permalinks in WordPress didn’t have to be changed.
So, instead of making your email links like this:
- site.com/es/category/postname/?utm_campaign=XXX&utm_medium=email&utm_source=YYY&utm_content=AAA&utm_term=BBB
make them like this (making sure the page_id points to the correct page of course):
- site.com/?page_id=00&lang=es&utm_campaign=XXX&utm_medium=email&utm_source=YYY&utm_content=AAA&utm_term=BBB
Of course, this was just my solution to the problem. Your mileage may vary.
| Print article | This entry was posted by Mark on March 18, 2010 at 8:39 pm, and is filed under Design, Social Media. Follow any responses to this post through RSS 2.0. You can leave a response or trackback from your own site. |




