Google analytics
-
Hello, I’m trying to add Google analytics following the guide http://beta.quasar-framework.org/guide/managing-google-analytics.html
However, I’m getting ‘dataLayer’ is not defined in analytics.js file. I see it is mentioned in index.html file. How do I import/define it properly?
Thanks, Roman
-
Ok, I have resolved it - to access dataLayer object you need to write:
window.dataLayer
So in index.html you include the GTM code and in analytics.js you write window.dataLayer instead of just dataLayer