Is actually a tutor-specific issue related to it seemingly doing UTF-16 encoding of the “-” character (from ASCII 0x2D to UTF-16 “\u002D”). You can see in the below hexdump that it definitely starts off as an ASCII 0x2D. But then as show in the above open edx forum posts, it ends up in javascript as \u002D, which causes google analytics to not work.)
Yes, you can see in the above hexdump that the double quotes are used, and correspond to hex 0x22 which is ASCII " (I was worried for a second when you said that, that maybe a unicode “curly quote” had been inserted, but it doesn’t look like it.)
(Also, can you look at the page source for your page, and let me know if you also see _gaq.push(['_setAccount', 'UA\u002D201443306']);
i.e. with the encoded -, or if it just shows up as a -?)
@oedx I managed to reproduce your issue. The Google analytics account and tracking ID are included in the main.html template with the following piece of code:
js_escaped_string is basically a call to Django’s own escapejs function. We can verify that this is the function that translates the dash “-” into " “\u002D”:
@oedx Tim McCormack (from edX) commented on my PR (here) that the connection to Google Analytics should still work despite the replacement of “-” by “\u002D”. Can you confirm? If this is true there is no need for my PR.
It definitely didn’t work (in the sense that no page views showed up), and I eventually just used the workaround mentioned here. I’m reticent to test the old way for fear of breaking it, but can perhaps give that a try during the Maple update.