How to use google analytics from jade file
google-analytics, node.js, pug
Solution
The solution was easy.
Step 1: i created a file called 'analytics.js' and placed the code between the script tags in it. No conversion to jade syntax needed.
Step 2: i referenced the script from the jade file
script(src='/js/analytics.js')
Problem
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> ```