Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit f28373b

Browse files
updated gtags
1 parent d6cfd2d commit f28373b

File tree

2 files changed

+21
-22
lines changed

2 files changed

+21
-22
lines changed

‎src/app/head.jsx‎

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,10 @@
1-
import Script from "next/script";
2-
import * as gtag from "../lib/gtag";
3-
41
export default function Head() {
52
return (
63
<>
74
<title>ScuffedCode</title>
85
<meta content="width=device-width, initial-scale=1" name="viewport" />
96
<meta name="description" content="Generated by create next app" />
107
<link rel="icon" href="/favicon.ico" />
11-
<Script
12-
strategy="lazyOnload"
13-
src={`https://www.googletagmanager.com/gtag/js?id=${gtag.GA_TRACKING_ID}`}
14-
/>
15-
<Script
16-
id="gtag-init"
17-
strategy="lazyOnload"
18-
dangerouslySetInnerHTML={{
19-
__html: `
20-
window.dataLayer = window.dataLayer || [];
21-
function gtag(){dataLayer.push(arguments);}
22-
gtag('js', new Date());
23-
gtag('config', '${gtag.GA_TRACKING_ID}', {
24-
page_path: window.location.pathname,
25-
});
26-
`,
27-
}}
28-
/>
298
</>
309
);
3110
}

‎src/app/layout.jsx‎

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,32 @@ import Link from "next/link";
33
import { AiFillLinkedin, AiFillGithub } from "react-icons/ai";
44
import { SiGooglescholar } from "react-icons/si";
55
import { Providers } from "./Providers";
6-
6+
import Script from "next/script";
7+
import * as gtag from "../lib/gtag";
78
import { DarkModeButton } from "./DarkModeButton";
89
import Head from "./head";
10+
911
export default function RootLayout({ children }) {
1012
return (
1113
<html lang="en">
14+
<Script
15+
strategy="lazyOnload"
16+
src={`https://www.googletagmanager.com/gtag/js?id=${gtag.GA_TRACKING_ID}`}
17+
/>
18+
<Script
19+
id="gtag-init"
20+
strategy="lazyOnload"
21+
dangerouslySetInnerHTML={{
22+
__html: `
23+
window.dataLayer = window.dataLayer || [];
24+
function gtag(){dataLayer.push(arguments);}
25+
gtag('js', new Date());
26+
gtag('config', '${gtag.GA_TRACKING_ID}', {
27+
page_path: window.location.pathname,
28+
});
29+
`,
30+
}}
31+
/>
1232
{/* <Head /> */}
1333
<body>
1434
<Providers>

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /