Files
buzz-sheet/components/public/google-adsense.tsx
T
gunshiz 910afdeb71
CI / Build immutable images and deploy (push) Successful in 1m52s
feat : dev on prod
2026-09-16 20:19:27 +07:00

31 lines
663 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="afterInteractive"
crossOrigin="anonymous"
/>
);
}