If you’re implementing code from a tracking brief, beware to watch out for rogue characters. The one we see most on a day to day basis is the slanted apostrophe ‘ which word inserts in place of ‘ . Note that the slanted instance won’t work within Javascript and will likely cause some sort of illegal token exception in your browser (“Unexpected Token Illegal” in Google Chrome”).
To summarise:
Correct:
_gaq.push([‘_setAccount’, ‘UA-120982-1’]);
_gaq.push([‘_trackPageview’]);
Incorrect:
_gaq.push([‘_setAccount’, ‘UA-120982-1’]);
_gaq.push([‘_trackPageview’]);
A quick fix to ensure you don’t fall into this trap again is to disable (or get your analytics team to disable…) this autocorrection in word. The steps are detailed here:Microsoft Word Formatting Documentation .
Within AutoFormat As You Type disable “Straight quotes” with “smart quotes”.
The obvious downside is that you’ll now lose slanted quotes in all your Word Documents.
Alternatively, look at introducing a process to the team who deliver your tracking code:

  • Ask them to write and save all code segments in a text editor, our favourite is notepad++.
  • Autocorrect only applies as you type. If they copy and paste these segments they won’t be affected.
  • Optionally, get them to supply you with the raw code as well as the brief. The danger here is to ensure the brief is still read thoroughly for any technical caveats or dependencies.

autocorrect-smartquotes