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.
About the author
Lynchpin
Lynchpin integrates data science, engineering and strategy capabilities to solve our clients’ analytics challenges. By bringing together complementary expertise we help improve long term analytics maturity while delivering practical results in areas such as multichannel measurement, customer segmentation, forecasting, pricing optimisation, attribution and personalisation.
Our services span the full data lifecycle from technology architecture and integration through to advanced analytics and machine learning to drive effective decisions.
We customise our approach to address each client’s unique situation and requirements, extending and complementing their internal capabilities. Our practical experience enables us to effectively bridge the gaps between commercial, analytical, legal and technical teams. The result is a flexible partnership anchored to clear and valuable outcomes for our clients.