A very quick little post as this struck me as so very basic and simple when it cropped up in an analytics tagging issue for one of my client’s recently. The theory was simple, the client was sending out a standard newsletter email and wanted to tag up the various sections of the email to be able track their impact on site traffic and visitor behaviour.
Check. Pat self on back for FINALLY getting the client on board when it comes to the absolute necessity of email tagging, and the simplicity of it – especially when using Google analytics.
Let’s take the example of this url: www.annabelhodges.com
Say I was sending out an email newsletter informing my blog readers of my panda giveaway, every person to fill in a questionnaire on my site will be entered to win a free panda.
The newsletter header would be tagged up something like this: www.annabelhodges.com?utm_source=newsletter&utm_medium=email&utm_name=pandagiveaway&utm_content=header
This would be fine sent directly through most of the major email marketing software companies, but what if like my client – I had just started to use a new in-house CMS that required a redirect via that CMS’ backend first before then redirecting again to the actual link url could look something more like:
www.annabelhodges.com?MailOutID=0&Type=3&Email=&Redirect=www.annabelhodges.com?utm_source=newsletter&utm_medium=email&utm_name=pandagiveaway&utm_content=header
This would mean that everything after that first query string ‘?’ would simply be ignored as it would all be associated back to the first redirect url rather than as a second entity in its own right with its own query string.
How to deal with this? Simple. Encode your url!
And it really is that simple – rather than using the ‘&’ as part of your second query string, encode it using %24 so that it continues to be read and passed through.
So your final url will look something like:
www.annabelhodges.com?utm_source=newsletter%26utm_medium
=email%26utm_name=pandagiveaway%26utm_content=header
In the case of analytics, the %26 is realistically the only change that you are likely to need. However for reference’s sake, here is a list of basic url encoding characters (borrowed from here):
| ; | %3B |
| ? | %3F |
| / | %2F |
| : | %3A |
| # | %23 |
| & | %26 |
| = | %3D |
| + | %2B |
| $ | %24 |
| , | %2C |
| <space> | %20 or + |
| % | %25 |
| < | %3C |
| > | %3E |
| ~ | %7E |
| % | %25 |



No Comments so far ↓
There are no comments yet...Kick things off by filling out the form below.