Skip to content

Commit 19132ec

Browse files
committed
fix: google analytics
1 parent e0252e5 commit 19132ec

File tree

2 files changed

+6
-19
lines changed

2 files changed

+6
-19
lines changed

postcss.config.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module.exports = {
2-
plugins: {
3-
tailwindcss: {},
4-
autoprefixer: {},
5-
},
6-
}
2+
plugins: {
3+
tailwindcss: {},
4+
autoprefixer: {},
5+
},
6+
};

theme.config.tsx

+1-14
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import React from "react";
22
import { DocsThemeConfig, useConfig } from "nextra-theme-docs";
33
import { useRouter } from "next/router";
44
import { GoogleAnalytics } from '@next/third-parties/google'
5-
import Script from "next/script";
65

76
const config: DocsThemeConfig = {
87
head: () => {
@@ -19,19 +18,7 @@ const config: DocsThemeConfig = {
1918
return (
2019
<>
2120
<title>{fullTitle}</title>
22-
<Script
23-
strategy='lazyOnload'
24-
src={`https://www.googletagmanager.com/gtag/js?id=${googleId}`}
25-
/>
26-
27-
<Script id='' strategy='lazyOnload'>
28-
{`
29-
window.dataLayer = window.dataLayer || [];
30-
function gtag(){dataLayer.push(arguments);}
31-
gtag('js', new Date());
32-
gtag('config', '${googleId}');
33-
`}
34-
</Script>
21+
<GoogleAnalytics gaId={googleId} />
3522
<link rel="icon" type="image/png" href="/logo.png" />
3623

3724
<meta httpEquiv="Content-Language" content="en" />

0 commit comments

Comments
 (0)