Just slide off my JavaScript training wheels.
Why unescape Google choose unescape document.write line in Part 1 below?
Why don't they just write it like that? Maybe unescape is required for older browser compatibility?
document.write('<script src="' + gaJsHost + 'google-analytics.com/ga.js" type="text/javascript"></script>');
For reference, the entire Google Analytics tracking code is as follows:
Part 1:
<script type="text/javascript"> var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www." ); document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E" )); </script>
Part 2:
<script type="text/javascript"> try { var pageTracker = _gat._getTracker("UA-0000000-0"); pageTracker._trackPageview(); } catch(err){} </script>
I understand what the rest of the code does, is just interested in the unescape part.
Edit
The bottom line says unescape . Voted to close this question because it is a duplicate (see Answer marked as correct).
javascript google-analytics
Jeff
source share