Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

141
Views
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 answers
Answer question

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 Report

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!