Skip to content
This repository has been archived by the owner on Jan 3, 2024. It is now read-only.

feat: update gtag #239

Merged
merged 1 commit into from
Sep 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 1 addition & 41 deletions src/pages/_app.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,10 +149,7 @@ function App({ Component, pageProps, router }) {
dangerouslySetInnerHTML={{
__html: `
function gtagReportConversion () {
gtag('event', 'conversion', {
'send_to': 'AW-11099522928/Jx0mCJK59OAYEPCO1awp',
});
return false;

}
`,
}}
Expand All @@ -163,43 +160,6 @@ function App({ Component, pageProps, router }) {
referrerpolicy="strict-origin-when-cross-origin"
></script>
</Head>
<Script>
{`(function(w, d, s, l, i) {
w[l] = w[l] || []
w[l].push({
"gtm.start": new Date().getTime(),
"event": "gtm.js",
})
var f = d.getElementsByTagName(s)[0],
j = d.createElement(s), dl = l != "dataLayer" ? "&l=" + l : ""
j.async = true
j.src =
"https://www.googletagmanager.com/gtm.js?id=" + i + dl
f.parentNode.insertBefore(j, f)
})(window, document, "script", "dataLayer", "GTM-NRT4JCB");`}
</Script>
{/*Google Tag Manager (noscript)*/}
<noscript>
<iframe
src="https://www.googletagmanager.com/ns.html?id=GTM-NRT4JCB"
height="0"
width="0"
style={{ display: 'none', visibility: 'hidden' }}
/>
</noscript>
{/*End Google Tag Manager (noscript)*/}
<Script
strategy="afterInteractive"
src="https://www.googletagmanager.com/gtag/js?id=AW-11099522928"
/>
<Script strategy="afterInteractive" id="google-analytics">
{`
window.dataLayer = window.dataLayer || [];
function gtag(){window.dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'AW-11099522928');
`}
</Script>
<Script strategy="afterInteractive">
{` _linkedin_partner_id = "4707852";
window._linkedin_data_partner_ids = window._linkedin_data_partner_ids || [];
Expand Down
40 changes: 18 additions & 22 deletions src/pages/_document.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,30 +55,24 @@ export default class Document extends NextDocument {
/>
<meta name="theme-color" content="#000000" />
<Script>
{`(function(w, d, s, l, i) {
w[l] = w[l] || []
w[l].push({
"gtm.start": new Date().getTime(),
"event": "gtm.js",
})
var f = d.getElementsByTagName(s)[0],
j = d.createElement(s), dl = l != "dataLayer" ? "&l=" + l : ""
j.async = true
j.src =
"https://www.googletagmanager.com/gtm.js?id=" + i + dl
f.parentNode.insertBefore(j, f)
})(window, document, "script", "dataLayer", "GTM-NRT4JCB");`}
{`(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-W52T2JWK');`}
</Script>

<Script
strategy="afterInteractive"
src="https://www.googletagmanager.com/gtag/js?id=AW-11099522928"
src="https://www.googletagmanager.com/gtag/js?id=G-QW745VE33W"
/>
<Script strategy="afterInteractive" id="google-analytics">
{`
window.dataLayer = window.dataLayer || [];
function gtag(){window.dataLayer.push(arguments);}
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'AW-11099522928');

gtag('config', 'G-QW745VE33W')
`}
</Script>
<script
Expand All @@ -101,14 +95,16 @@ export default class Document extends NextDocument {
!this.props.dangerousAsPath.startsWith('/examples/'),
})}
>
{/* <!-- Google Tag Manager (noscript) --> */}
<noscript>
{/*<iframe*/}
{/* src="https://www.googletagmanager.com/ns.html?id=GTM-NRT4JCB"*/}
{/* height="0"*/}
{/* width="0"*/}
{/* style={{ display: 'none', visibility: 'hidden' }}*/}
{/*/>*/}
<iframe
src="https://www.googletagmanager.com/ns.html?id=GTM-W52T2JWK"
height="0"
width="0"
style="display:none;visibility:hidden"
></iframe>
</noscript>
{/* <!-- End Google Tag Manager (noscript) --> */}
<Main />
<NextScript />
<script> </script>
Expand Down