ads: drop IntersectionObserver gate — one mount = one impression
This commit is contained in:
@@ -53,30 +53,13 @@ export default function AdImage({
|
||||
const id = ad.campaign_id || ad.slug;
|
||||
if (!id) return;
|
||||
|
||||
// One impression per pageview per banner, fired on mount. No viewport
|
||||
// gate — too many ad slots sit below-the-fold and the IO threshold
|
||||
// suppressed real signal.
|
||||
if (!beaconMount.current) {
|
||||
beaconMount.current = true;
|
||||
sendImpression(id, page, false);
|
||||
}
|
||||
|
||||
const el = containerRef.current;
|
||||
if (!el) return;
|
||||
|
||||
const observer = new IntersectionObserver(
|
||||
(entries) => {
|
||||
for (const e of entries) {
|
||||
if (e.isIntersecting) {
|
||||
const now = Date.now();
|
||||
if (now - lastViewportFire.current >= 12000) {
|
||||
lastViewportFire.current = now;
|
||||
sendImpression(id, page, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{ threshold: 0.5 },
|
||||
);
|
||||
observer.observe(el);
|
||||
return () => observer.disconnect();
|
||||
}, [ad.src, ad.slug, ad.campaign_id, page]);
|
||||
|
||||
if (!ad.src) return null;
|
||||
|
||||
Reference in New Issue
Block a user