Skip to content

Commit de8b2a2

Browse files
committed
fix: update Google AdSense script source to use dynamic publisher ID
1 parent 20fad0f commit de8b2a2

1 file changed

Lines changed: 1 addition & 3 deletions

File tree

src/GoogleAdSense.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66
import { usePathname } from "next/navigation";
77
import type { ScriptProps } from "next/script";
8-
import Script from "next/script";
98
// biome-ignore lint/correctness/noUnusedImports: React refers to a UMD global, but the current file is a module.
109
import React, { useEffect } from "react";
1110
import { isPublisherId } from "./utils";
@@ -46,8 +45,7 @@ export const GoogleAdSense = ({
4645

4746
// Re-insert the script
4847
const script = document.createElement("script");
49-
script.src =
50-
"https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-XXXXXXXXXXXX";
48+
script.src = `https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-${_publisherId}`;
5149
script.async = true;
5250
script.crossOrigin = "anonymous";
5351
document.head.appendChild(script);

0 commit comments

Comments
 (0)