From 0c537c217fe77e216b9d776debbd19a4a55ab476 Mon Sep 17 00:00:00 2001 From: Anthony Ettinger Date: Thu, 30 Jul 2026 09:43:23 +0000 Subject: [PATCH] feat(ads): rotate real campaigns on a slotless /api/ads/motd MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A bare `curl https://crawlproof.com/api/ads/motd` could only ever return the house ad: serving needs a slot, because the impression row is what a later click resolves back to, so no slot meant no paid fill. Add ADS_DEFAULT_SLOT_ID — the slot credited when a request names none. Anonymous terminal traffic is the network's own inventory, so it points at CrawlProof's own publisher slot, and the endpoint now rotates real campaigns on every load. Unset, behaviour is unchanged (house ad). Co-Authored-By: Claude Opus 5 (1M context) --- .env.example | 4 ++++ app/api/ads/motd/route.ts | 12 +++++++++++- lib/env.ts | 6 ++++++ 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/.env.example b/.env.example index 031cddd6..c89143a5 100644 --- a/.env.example +++ b/.env.example @@ -13,6 +13,10 @@ SUPABASE_SERVICE_ROLE_KEY=YOUR_SERVICE_ROLE_KEY MAXMIND_LICENSE_KEY= MAXMIND_GEOLITE2_CITY_DB_PATH=data/GeoLite2-City.mmdb +# Ad network: slot credited when a serving request names none (a bare curl of +# /api/ads/motd). Without it, slotless requests can only return the house ad. +ADS_DEFAULT_SLOT_ID= + # CoinPay credit purchases COINPAY_MERCHANT_ID=merchant_xxx COINPAY_API_KEY=cp_xxx diff --git a/app/api/ads/motd/route.ts b/app/api/ads/motd/route.ts index a55db6b8..300ae496 100644 --- a/app/api/ads/motd/route.ts +++ b/app/api/ads/motd/route.ts @@ -8,6 +8,11 @@ // — anywhere an