I want to track the users of my website. Since I do not have an old fashioned HTML file, should I adapt the given code to the jade syntax or can i leave the script untouched and include it somehow?
In case I need to convert it to jade syntax, can this be auto generated by some tool.
<script>
(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-XXXXXXXX-X', 'domain.com');
ga('send', 'pageview');
</script>
Instead of having it look for another code file and load it. Inline (like Trevor suggested is better).
In order to accomplish this you have to make use of the script.
tag.... not just script
See below:
script.
(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-11111111-1', 'yourdomain.com');
ga('send', 'pageview');
Make sure the spacing and such is actually indented one tab from your stuff