diff --git a/components/public/google-adsense.tsx b/components/public/google-adsense.tsx
index b1e8822..d78b88c 100644
--- a/components/public/google-adsense.tsx
+++ b/components/public/google-adsense.tsx
@@ -1,21 +1,9 @@
-"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
- ) {
+ if (process.env.NODE_ENV !== "production" || !clientId) {
return null;
}
diff --git a/tests/public-performance.test.ts b/tests/public-performance.test.ts
index 1b878bc..7b6e3d5 100644
--- a/tests/public-performance.test.ts
+++ b/tests/public-performance.test.ts
@@ -59,7 +59,7 @@ describe("public rendering performance", () => {
});
});
- it("loads AdSense only after confirming the visitor is signed out", async () => {
+ it("loads AdSense for every visitor, including signed-in admins", async () => {
const [adsense, home, guide, guideSection, adsTxt] = await Promise.all([
repositoryFile("components/public/google-adsense.tsx"),
repositoryFile("app/page.tsx"),
@@ -68,9 +68,9 @@ describe("public rendering performance", () => {
repositoryFile("public/ads.txt"),
]);
- expect(adsense).toContain("authClient.useSession()");
+ expect(adsense).not.toContain("authClient.useSession()");
+ expect(adsense).not.toContain('from "@/lib/auth/client"');
expect(adsense).toContain('process.env.NODE_ENV !== "production"');
- expect(adsense).toMatch(/isPending \|\|\s+error \|\|\s+session/u);
expect(adsense).toContain("pagead2.googlesyndication.com");
expect(home).toContain("");
expect(guide).toContain("");