Adding Google Analytics to app

Hello, I am trying to integrate Google Analytics through a global tag through react-helmet but no page views show up on Analytics.

The following code should trigger an automatic pageView on Google Analytics when the app initially loads, but it doesn’t.

<Helmet>
        <script
          async
          src={`https://www.googletagmanager.com/gtag/js?id=${GA_MEASUREMENT_ID}`}
        />
        <script
          dangerouslySetInnerHTML={{
            __html: `
            window.dataLayer = window.dataLayer || [];
            function gtag(){dataLayer.push(arguments);}
            gtag('js', new Date());

            gtag('config', '${GA_MEASUREMENT_ID}');
          `,
          }}
        />
</Helmet>

I can see it loads properly, but no events are being registered on Analytics.

Is this allowed through an app? Would appreciate some direction, thanks!

This topic was solved and automatically closed 15 days after the last reply. New replies are no longer allowed.