-
How to Integrate Google Analytics 4 into a .pug Template
Hey guys, I’m just trying to get my head around the Google Analytics 4 integration with a .pug template file. You see, this coding thing, including Google Analytics, is all very new to me, so I reckon there’s a chance I’ve missed something glaringly obvious, but the mistake is eluding me for now.
I’ve been doing my homework and stumbled upon this old conversation from a few years back. I tried to follow the “2019 GTag Update” solution that was shared on August 19, 2016. The thing is, I can’t seem to get Google Analytics to kick off. I’m stuck with this pesky notice popping up in my Google Analytics property telling me that it isn’t collecting any data.
What’s puzzling me is that when I double-check my site and examine the HTML, everything seems right on the money and looks exactly like what Google Analytics asks for in their tagging instructions.
Would really appreciate if someone can shed some light on this! Here’s the bit of code:
head // Google tag (gtag.js) script(async='' src='https://www.googletagmanager.com/gtag/js?id=G-**********') script. window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'G-**********'); title= title
Cheers!
Log in to reply.