Implement Window Data Layer Push in React App

Viewed 1174

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;
1 Answers
Related