maxandriani/ngx-google-analytics

Google Tag Manager Question

Opened this issue · 1 comments

Hey everyone,

I have a question about using this package with Google Tag Manager versus Global Site Tag.

Since the library allows me to pass the uri within the config options along with the trackingCode, I can connect Google Tag Manager (https://googletagmanager.com/gtm...) instead of the Global Site Tag (https://googletagmanager.com/gtag...).

{
  trackingCode: "MY_GTM_ID",
  uri: "https://googletagmanager.com/gtm.js?id=MY_GTM_ID"
}

To the best of my knowledge, both Google Tag Manager and Global Site Tag use the same data layer. I tested this theory by previewing my site within Tag Assistant with the above configuration. Everything appeared to work as expected (e.g., page_view event fired on route change, etc.).

I'm wondering if anyone has done something similar or advises against doing this.

Thanks!

P.S. Love this package. Well documented and easy to follow the internals.

This will just work without any issues like in your test.

BTW, I have forked the library and published a new version of the library for Angular 16:
Release announcement
Installation and usage