I followed the instruction on http://www.iis.net/learn/extensions/url-rewrite-module/using-outbound-rules-to-add-web-analytics-tracking-code
I tried to use this, but the code would not if in one line:
<script type='text/javascript'> (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); ga('create', 'UA-99999999-1', 'auto'); ga('send', 'pageview'); </script>
So I change it to one line like so:
<script type='text/javascript' >(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)})(window,document,'script','//www.google-analytics.com/analytics.js','ga');ga('create', 'UA-99999999-1', 'auto');ga('send', 'pageview');</script></body>
When my pages run and I look at the source code I get this instead:
<script type='text/javascript' >(function(i,s,o,g,r,a,m))(window,document,'script','//www.google-analytics.com/analytics.js','ga');ga('create', 'UA-44001733-1', 'auto');ga('send', 'pageview');</script>
Notice the following code is gone from my response:
{i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)}
What am I doing wrong? Any ideas?