Board View GA4 implementation via GTM

Hello, I tried to implement Google Analytics 4 via Google Tag Manager in my app. But it is sends almost 0 hits to GA4.

I’m also using dataLayer to to capture important data about current page.

Any advice, solution or recommend way?

Thank you.

Hello there @marekd and welcome to the community!

Would you be able to please fill this form so our team can take a look into this? Please add as much detail about your case as possible.

Looking forward to hearing from you via the form!

Cheers,
Matias

1 Like

@marekd @Matias.Monday

It’s likely that using GA4 via GTM does not set cookies correctly in an iframe.

Have you specified Cookies Having Independent Partitioned State (CHIPS)?

You’ll probably need to set cookie flags as follows:

SameSite=None;Secure;Partitioned

If you can’t do that in GTM, then you’ll have to use the standard GA4 script and the cookie_flags option instead.

Something similar to this:

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

Repace G-XXXXX in both places with your tracking code

1 Like

Thank you @dvdsmpsn ! Will test it and get back with results.

1 Like

Thank you @dvdsmpsn for the suggestion!!

1 Like

This worked like a charm. Thank you David!

1 Like