escopecz / grav-ganalytics

Google Analytics plugin for Grav CMS
MIT License
20 stars 9 forks source link

Main Google script missing after update to v2 #39

Closed Karmalakas closed 1 year ago

Karmalakas commented 1 year ago

After updating to v2, I noticed, that in the source code, the main tag manager script load is missing. Googles instructions say we need to have:

<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id={TRACKING_ID}"></script>
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());

  gtag('config', '{TRACKING_ID}');
</script>

And I see in the source the second script, but the main script is not there:

<script async src="https://www.googletagmanager.com/gtag/js?id={TRACKING_ID}"></script>

cc: @ViliusS

Karmalakas commented 1 year ago

Ah, I see it's in one of the compressed scripts. I guess it goes through the Grav assets pipeline. Is this correct?

ViliusS commented 1 year ago

v2 should behave exactly the same way as v1 with async property enabled, i.e. it should go through the pipeline if pipeline is enabled. Is this a problem?

Karmalakas commented 1 year ago

No, I guess not 🙂 I just checked and it works just fine. At first I was a bit worried when I didn't notice the script. Sorry for the disturbance. Great job 😉