Skip to content

Commit

Permalink
google analytics update
Browse files Browse the repository at this point in the history
  • Loading branch information
KirillBashorin committed Mar 5, 2024
1 parent caab120 commit 46072fc
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 31 deletions.
30 changes: 29 additions & 1 deletion src/pages/_app.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Component } from 'react';
import { NextPage } from 'next';
import Script from 'next/script';

import type { AppProps } from 'next/app';

Expand All @@ -14,7 +15,34 @@ function MyApp({ Component, pageProps }: AppProps) {
).getLayout || ((page: JSX.Element) => <>{page}</>);

// @ts-ignore
return getLayout(<Component {...pageProps} />);
return getLayout(
<>
{/* eslint-disable-next-line @next/next/inline-script-id */}
<Script type='text/javascript' strategy='lazyOnload'>
{` (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-59SZ89GV');`}
</Script>
{/* eslint-disable-next-line @next/next/inline-script-id */}
<Script
strategy='lazyOnload'
src={`https://www.googletagmanager.com/gtag/js?id=G-1LQ0CQHBYY`}
/>
{/* eslint-disable-next-line @next/next/inline-script-id */}
<Script type='text/javascript' strategy='lazyOnload'>
{`
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-1LQ0CQHBYY');
`}
</Script>
<Component {...pageProps} />
</>
);
}

// noinspection JSUnusedGlobalSymbols
Expand Down
30 changes: 0 additions & 30 deletions src/pages/_document.tsx
Original file line number Diff line number Diff line change
@@ -1,41 +1,11 @@
import { Html, Head, Main, NextScript } from 'next/document';
import React from 'react';
// eslint-disable-next-line @next/next/no-script-in-document
import Script from 'next/script';

// noinspection JSUnusedGlobalSymbols
export default function Document() {
return (
<Html lang='en'>
<Head>
<Script
strategy='lazyOnload'
src={`https://www.googletagmanager.com/gtag/js?id=XXXXXXXXXX`}
/>
<Script
strategy='lazyOnload'
src={`https://www.googletagmanager.com/gtag/js?id=G-1LQ0CQHBYY`}
/>
{/* eslint-disable-next-line @next/next/inline-script-id */}
<Script strategy='lazyOnload'>
{`
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-177155812-1');
`}
</Script>
{/* eslint-disable-next-line @next/next/inline-script-id */}
<Script strategy='lazyOnload'>
{`
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-1LQ0CQHBYY');
`}
</Script>
{/* eslint-disable-next-line @next/next/no-title-in-document-head */}
<title>
Blockchain, IT, Web3 Development Company | Blockchain Software
Expand Down

0 comments on commit 46072fc

Please sign in to comment.