1
1
import { CssBaseline , GeistProvider } from '@geist-ui/react'
2
2
import { AppProps } from 'next/app'
3
+ import Script from 'next/script'
3
4
import Head from 'next/head'
5
+ import * as gtag from '../common/ga'
4
6
import { LocaleProvider , useLocale } from '../common/hooks/useLocale'
5
7
6
8
const App : React . FC < AppProps > = ( { Component, pageProps } ) => {
@@ -15,20 +17,33 @@ const App: React.FC<AppProps> = ({ Component, pageProps }) => {
15
17
name = "viewport"
16
18
content = "width=device-width, initial-scale=1, user-scalable=no"
17
19
/>
18
- < meta
19
- name = "description"
20
- content = { t ( 'AppDesc' ) }
21
- />
20
+ < meta name = "description" content = { t ( 'AppDesc' ) } />
22
21
< meta
23
22
name = "keywords"
24
23
content = "ETH,EVM,EVM Compatible Network,Network,Blockchain,chain"
25
24
/>
26
25
< meta property = "og:title" content = "EVM Box" />
27
- < meta
28
- property = "og:description"
29
- content = { t ( 'AppDesc' ) }
30
- />
26
+ < meta property = "og:description" content = { t ( 'AppDesc' ) } />
31
27
</ Head >
28
+ { /* Global Site Tag (gtag.js) - Google Analytics */ }
29
+ < Script
30
+ strategy = "afterInteractive"
31
+ src = { `https://www.googletagmanager.com/gtag/js?id=${ gtag . GA_TRACKING_ID } ` }
32
+ />
33
+ < Script
34
+ id = "gtag-init"
35
+ strategy = "afterInteractive"
36
+ dangerouslySetInnerHTML = { {
37
+ __html : `
38
+ window.dataLayer = window.dataLayer || [];
39
+ function gtag(){dataLayer.push(arguments);}
40
+ gtag('js', new Date());
41
+ gtag('config', '${ gtag . GA_TRACKING_ID } ', {
42
+ page_path: window.location.pathname,
43
+ });
44
+ ` ,
45
+ } }
46
+ />
32
47
< Component { ...pageProps } />
33
48
</ GeistProvider >
34
49
</ LocaleProvider >
0 commit comments