ads: route all clicks through advertising.RMP.com/r/<id> + cache-aware banner reads
Two compounding bugs caused 0 clicks since May 22: 1. lib/ads.ts exported ADS_728X90 / ADS_300X250 / FIXED_300X600 as IIFE-evaluated module constants. They captured the FALLBACK array at module-load time, before the centralized RMP banner cache populates. Every render that referenced them got FALLBACK banners whose click_url was the direct advertiser URL — bypassing the centralized click logger entirely. 300x250s escaped because every page reads them via rotateAll() at render time. 2. Even when the new RMP-cache banners did render, click_url pointed at www.RMP.com/<property>/<slug>, which logs to adv.banner_clicks. The RMP analytics dashboard reads bb.ad_clicks. Repointed click URLs at advertising.RMP.com/r/<campaign_id> so all clicks land in the single table the dashboard queries. Files: lib/ads.ts (remove broken IIFE exports + repoint click_url), SidebarAdStack, Header, Footer, and 9 pages (reading-list, forum, forum/thread, search, gear, technology, authors, show-coverage x2). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -5,7 +5,7 @@ import Header from '@/components/Header';
|
||||
import Footer from '@/components/Footer';
|
||||
import AdImage from '@/components/AdImage';
|
||||
import SidebarAdStack from '@/components/SidebarAdStack';
|
||||
import { ADS_728X90, shuffle } from '@/lib/ads';
|
||||
import { pickAds } from '@/lib/ads';
|
||||
import { createClient } from '@/lib/supabase/client';
|
||||
|
||||
interface ForumCategory {
|
||||
@@ -632,9 +632,9 @@ export default function ForumIndexPage() {
|
||||
</div>
|
||||
|
||||
{/* In-content 728x90 banner */}
|
||||
{ADS_728X90.length > 0 && (
|
||||
{pickAds("728x90", 1).length > 0 && (
|
||||
<div className="mt-10 hidden md:flex justify-center" aria-label="Advertisement">
|
||||
<AdImage ad={shuffle(ADS_728X90)[0]} page="forum" />
|
||||
<AdImage ad={pickAds("728x90", 1)[0]} page="forum" />
|
||||
</div>
|
||||
)}
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ import { useParams } from 'next/navigation';
|
||||
import Header from '@/components/Header';
|
||||
import Footer from '@/components/Footer';
|
||||
import AdImage from '@/components/AdImage';
|
||||
import { ADS_300X250, rotateAll } from '@/lib/ads';
|
||||
import { pickAds, rotateAll } from '@/lib/ads';
|
||||
import { createClient } from '@/lib/supabase/client';
|
||||
import SidebarAdStack from "@/components/SidebarAdStack";
|
||||
import LinkifyPlainText from "@/components/LinkifyPlainText";
|
||||
@@ -13,7 +13,7 @@ import CompanyMentionsHover from "@/components/CompanyMentionsHover";
|
||||
|
||||
// Inline ad slot inserted between forum replies every N posts.
|
||||
function InThreadAd({ adIndex }: { adIndex: number }) {
|
||||
const pool = ADS_300X250;
|
||||
const pool = rotateAll("300x250");
|
||||
if (pool.length === 0) return null;
|
||||
const ad = pool[adIndex % pool.length];
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user