Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

145
Visualizações
Implement Window Data Layer Push in React App

I'm trying to implement window.data.layer.push in my react application so I can use it with Google Tag Manager but I am unsure where it would go. this is my base app.js file

// import the GTM Module so you can access it
import TagManager from "react-gtm-module";

const tagManagerArgs = {
    gtmId: "GTM-P8J3MKF"
  };
  
TagManager.initialize(tagManagerArgs)

const { persistor, store } = configureStore();

const MGMW = () => (
  <Provider store={store}>
    <PersistGate loading={null} persistor={persistor}>
  {/*<LoginScene className='main-background' />*/}
      <LayoutBase />
      <GlobalModals />
    </PersistGate>
  </Provider>
);

const rootElement = document.getElementById('app-root');
if (rootElement) render(<MGMW />, rootElement);

export default MGMW;
about 4 years ago · Juan Pablo Isaza
2 Respostas
Responde à pergunta

0

You must use useEffect hook.

useEffect(() => {
    /*script to be executed here*/
}, [])

This is the componentDidMount version of React Hooks. More on the subject here: https://reactjs.org/docs/hooks-effect.html

about 4 years ago · Juan Pablo Isaza Relatório

0

There is an NPM package that can help you with this: https://www.npmjs.com/package/react-gtm-module

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda