← Sessions Tools

Ad Scheduler

Every homepage banner and in-menu ad campaign, past and scheduled. Swaps happen server-side at the scheduled instant — no deploy, no one awake at midnight. The website asks the worker which campaign set is active on every visit.

Loading schedule…

How this works

Campaign sets live as rows in the ad_campaigns table (D1). Each row can carry an active_from time (UTC). The worker endpoint /api/ad-campaigns always serves the row with the latest active_from that has passed — so a swap is just a row with a future timestamp. The cache window automatically shrinks as a flip approaches so the swap lands on time.

Testing a future state on the live site (safe — only you see it): open any page with ?adpreview_at=<UTC time>, e.g. the preview links on each scheduled card above. Customers are unaffected.

Rollback: insert a new row with the old config and an active_from of now. The site follows within 5 minutes.