Files
buzz-sheet/components/public/google-adsense.tsx
T
gunshiz 87e6bcd96f
CI / Verify and audit (push) Successful in 2m33s
CI / Build, scan and deploy immutable images (push) Failing after 1m29s
feat : 6 astra improve it
2026-09-22 18:28:18 +07:00

31 lines
657 B
TypeScript

"use client";
import Script from "next/script";
import { authClient } from "@/lib/auth/client";
const clientId = process.env.NEXT_PUBLIC_GOOGLE_ADSENSE_CLIENT_ID?.trim();
export function GoogleAdsense() {
const { data: session, error, isPending } = authClient.useSession();
if (
process.env.NODE_ENV !== "production" ||
!clientId ||
isPending ||
error ||
session
) {
return null;
}
return (
<Script
id="google-adsense"
src={`https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=${encodeURIComponent(clientId)}`}
strategy="lazyOnload"
crossOrigin="anonymous"
/>
);
}