Code Typo In Google Analytics Demographics and Interests Reports Snippet
Ah. The old apostrophe that looks like a single quote catastrophe all code monkeys dread.
Warning! If you have it on your to-do list to get your Google Analytics account up and running with the new Google Analytics Demographics and Interests reports be aware that there is a sneaky apostrophe in the DC.js code snippet supplied on the Enable Demographics and Interests Google Analytics Help page that should be a single quote.
To get demographic and interests data flowing into your GA account, Google Analytics Help instructs you to:
ga.src = (‘https:’ == document.location.protocol ?’https://ssl’ : ‘http:// www’) + ‘google-analytics.com/ga.js’;
ga.src = (‘https:’ == document.location.protocol ? ‘https://’ : ‘http://’) + ‘stats.g.doubleclick.net/dc.js’;
Note to innocent copy-pasters that the ‘ before ‘stats.g.doubleclick.net/dc.js’; is typed as an apostrophe on the help page (and here because WordPress keeps changing the HTML…) and needs to be changed to a single quote in order to avoid a frustrating GA crash and a long-winded troubleshooting session.
Questions? Ask away in the comments section!