Skip to content

Commit b000632

Browse files
committed
chore: add google ads
1 parent ef3d2f8 commit b000632

2 files changed

Lines changed: 11 additions & 0 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,4 @@ jspm_packages
3838
.next
3939

4040
.DS_Store
41+
.env*

src/app/layout.tsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { Noto_Sans_SC, ZCOOL_KuaiLe } from 'next/font/google'
33
import '@/app/globals.css'
44
import { headers } from 'next/headers'
55
import { NextAppDirEmotionCacheProvider } from 'tss-react/next/appDir'
6+
import Script from 'next/script'
67
import { cn } from '@/lib/utils'
78
import { Toaster } from '@/components/ui/toaster'
89

@@ -72,6 +73,15 @@ export default function RootLayout({
7273
}>) {
7374
return (
7475
<html lang="en" className="h-full break-words overflow-hidden" data-platform={getPlatform()}>
76+
<head>
77+
{/* Google Adsense */}
78+
<Script
79+
async
80+
src={`https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-${process.env.NEXT_PUBLIC_GOOGLE_ADSENSE_CLIENT_ID}`}
81+
crossOrigin="anonymous"
82+
strategy="afterInteractive"
83+
/>
84+
</head>
7585
<body className={cn('h-full antialiased', notoSansSc.variable, zCoolKuaiLe.variable)}>
7686
<NextAppDirEmotionCacheProvider options={{ key: 'tss' }}>
7787
{children}

0 commit comments

Comments
 (0)