Help

Adding Google Analytics to app

Topic Labels: Custom Extensions
758 0
cancel
Showing results for 
Search instead for 
Did you mean: 
knjo
4 - Data Explorer
4 - Data Explorer

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!

0 Replies 0