First-party retargeting: audiences (automatic 'My visitors' fed by pages + zones, custom pixel audiences via /p.js + /p.gif, ls.vid cookie + 24 h soft key), include/exclude audience targeting on banner/text/login campaigns, zone tag sends credentials with CORS echo, audience-targeted campaigns never syndicate, Audiences panel on Zones and selector on Ads

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
martbost
2026-10-08 16:42:02 -05:00
parent b379f4adda
commit 92c5b777da
11 changed files with 180 additions and 16 deletions
+3
View File
@@ -7,6 +7,7 @@
const fs = require('fs');
const path = require('path');
const crypto = require('crypto');
const audiences = require('./audiences');
let DATA_DIR = null, ads = null, siteHost = 'linkspin.app';
const SIZES = { '728x90': [728, 90], '468x60': [468, 60], '300x250': [300, 250], '336x280': [336, 280], '250x250': [250, 250], '125x125': [125, 125], '160x600': [160, 600], '120x600': [120, 600], '320x50': [320, 50] }; // + 336x280 / 250x250 / 125x125 / 120x600 (Marty 2026-10-07)
// neutral file names on purpose: EasyList blocks any URL with an IAB size token like '-728x90.' (Marty's own blocker hid
@@ -72,6 +73,8 @@ async function serve(zoneId, req, geoOpts) {
// origin lock: paid inventory (campaigns, network ads) only on the declared site; anywhere else, or with no referrer,
// the tag shows the house banner and nothing is earned. An admin pause does the same.
const off = !onDeclaredSite(z, siteHostOf(req)); const paidOk = !vis.bot && !off && !z.adminPaused;
// retargeting: a real view on the declared site puts the visitor in the zone owner's automatic audience (30 days)
if (!off && !vis.bot && geoOpts && (geoOpts.vid || geoOpts.soft)) { try { audiences.hit(audiences.defaultFor(z.owner), geoOpts.vid, geoOpts.soft); } catch (e) {} }
// waterfall: 1) a LinkSpin member campaign 2) a Network Ad Space ad (NAS serves 728x90 and 468x60) 3) the LinkSpin house banner
let ad = null; if (paidOk) { try { ad = await ads.serve('banner', Object.assign({ width: w, height: h, excludeEmail: z.owner }, geoOpts || {})); } catch (e) { ad = null; } }
const nas = !ad && paidOk && s.nasOn && NAS_SIZES.has(z.size);