mirror of
https://github.com/profullstack/logicsrc.git
synced 2026-12-01 17:24:48 +00:00
feat(web): ad.network unit + claim meta on the home page
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
92d0666e98
commit
445554459f
5 changed files with 48 additions and 1 deletions
|
|
@ -115,5 +115,22 @@ export function HomeInteractivity(): null {
|
|||
};
|
||||
}, []);
|
||||
|
||||
// The home page ad.network unit lives in the server-rendered markup, and
|
||||
// crawlproof's ad.js scans once at DOMContentLoaded. A client-side visit to
|
||||
// "/" (from /blog, say) re-renders the markup after that scan, so ask the
|
||||
// loader to scan again, retrying briefly while the script is still loading.
|
||||
useEffect(() => {
|
||||
if (!document.querySelector("[data-ad-network]")) return;
|
||||
let tries = 0;
|
||||
const timer = window.setInterval(() => {
|
||||
const ads = (window as { crawlproofAds?: { scan?: () => void } }).crawlproofAds;
|
||||
if (ads?.scan || ++tries >= 20) {
|
||||
window.clearInterval(timer);
|
||||
ads?.scan?.();
|
||||
}
|
||||
}, 250);
|
||||
return () => window.clearInterval(timer);
|
||||
}, []);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue