(Mildly) improving Google Analytics' JS Embed
Celebrity that I am, I use Google Analytics to figure out exactly how many times I’ve visited my own website in a given day. The interface is surprisingly good (given that it’s a Google app), and generally I’m happy with the service. Also, it’s free (assuming that you don’t worry about giving Google even more of your data). Yay free.
I understand why they need to differentiate SSL requests, but passing a cobbled-together string through
unescape before feeding it to
document.write is a bit much, don’t you think? Also, injecting
gaJsHost as new global variables isn’t particularly friendly.
Given that I can make the assumption that this site is unencrypted, let’s change the code a bit to fix these two points:
That’s a little better. And it even JSLints.— Mike West