mirror of
https://github.com/jambonz/next-static-site.git
synced 2026-10-04 02:04:26 +00:00
handle page views for google tag manager
This commit is contained in:
+23
-6
@@ -1,12 +1,29 @@
|
||||
import '../src/styles/global.scss';
|
||||
import { useEffect } from 'react'
|
||||
import TagManager from 'react-gtm-module'
|
||||
import { useEffect } from 'react';
|
||||
import TagManager from 'react-gtm-module';
|
||||
import { usePageViewTracking } from '../src/components/hooks.js';
|
||||
|
||||
const gtmId = 'G-7J55WH6BVM';
|
||||
|
||||
const gtagId = 'G-7J55WH6BVM';
|
||||
|
||||
export default function App({ Component, pageProps }) {
|
||||
useEffect(() => {
|
||||
TagManager.initialize({ gtmId })
|
||||
TagManager.initialize({
|
||||
gtmId: gtagId,
|
||||
dataLayer: {
|
||||
gtag_id: gtagId,
|
||||
config: {
|
||||
[gtagId]: { groups: 'default' },
|
||||
},
|
||||
},
|
||||
});
|
||||
}, []);
|
||||
return <Component {...pageProps} />
|
||||
}
|
||||
|
||||
usePageViewTracking(gtagId);
|
||||
|
||||
return <Component {...pageProps} />;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user