Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to trigger preview mode with the associated environment in the code? #72

Open
vidrepar opened this issue Mar 3, 2023 · 1 comment

Comments

@vidrepar
Copy link

vidrepar commented Mar 3, 2023

Is it possible to open preview mode in GTM for the environment specified in the code?

Currently, I have to select the environment via GTM UI (see images) to debug the specific environment. The code doesn't seem to force the preview mode to the desired environment (eg. staging).

Initialization code:

  const { init, UseGTMHookProvider } = useGTM();
  
  useEffect(() => {
    init({
        id: process.env.REACT_APP_GTM as string,
        environment: {
          gtm_auth: '<GTM_AUTH_STRING>',
          gtm_preview: 'env-128',
        };,
      });
    }, []);

image
image

Thanks for the lib @elgorditosalsero 🙏

@elgorditosalsero
Copy link
Owner

Hey @vidrepar, I'll try to take a look soon, but if someone wants to help, is welcome.

Sorry for the late answer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants