Skip to content

no gtagOption for debug_mode? #79

Closed

Description

@ezbeazy

I don't see the gtag debug_mode option mapped to any parameter for ReactGA.initialize(). It also doesn't appear to be related to options.testMode, and I don't know what testMode is for since their is no description. Will the below not work? How can we use debug_mode? and what is options.testMode for?

    export const initGA = (ga4Id: string, devMode: boolean) => {
        ReactGA.initialize(ga4Id, {dev_mode: devMode});
    };
if (
    !window.GA_ANALYTICS &&
    googleAnalyticsTrackingCode
    ){
      
      if (apiHost.includes('localhost:'){
        initGA(googleAnalyticsTrackingCode, true);
      } else {
        initGA(googleAnalyticsTrackingCode, false);
      }

     window.GA_ANALYTICS = true;
}

Activity

  1. ezbeazy commented on Jul 14, 2024

    @ezbeazy
    Author

    upon further inspection it appears gatagOptions does allow the flexibility to add options not explicitly mapped and I should be able to use the dev_mode option described in the "Monitor events in DebugView" help article. Is that correct?

  2. KrisLau commented on Oct 31, 2024

    @KrisLau

    Did you ever figure it out?

  3. anindya-dhruba commented on Jun 16, 2026

    @anindya-dhruba

    This works for me:

    ReactGA4.initialize(GA4_MEASUREMENT_ID, {
      gaOptions: {
        debug_mode: true
      }
    });
    

    You can view the tracking data in the Debug View page.

    Note: To disable debug mode, remove the debug_mode. Setting this to false won't work.

  4. Repository owner locked and limited conversation to collaborators on Aug 29, 2026
  5. converted this issue into a discussion #98 on Aug 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions