The code suggested for GA causes EJS to throw the dreaded 'no title defined' exception if used as is.
layout.ejs
If comment out datalayer init line EJS works but GA complains datalayer not defined.
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-4351854-3"></script>
<script>
// window.dataLayer = window.dataLayer || []; // This breaks EJS
function gtag()
{
dataLayer.push(arguments);
}
gtag('js', new Date());
gtag('config', 'UA-4351854-3');
</script>
The code suggested for GA causes EJS to throw the dreaded 'no title defined' exception if used as is.
layout.ejs
If comment out datalayer init line EJS works but GA complains datalayer not defined.