NAS: syndicated ads click through our redirect so network clicks count and carry the source site
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
@@ -75,7 +75,8 @@ async function pushCampaign(c, opts = {}) {
|
|||||||
(Username, Subject, Body, WebsiteURL, assigned, remaining, hits, approved, Date, adtype,
|
(Username, Subject, Body, WebsiteURL, assigned, remaining, hits, approved, Date, adtype,
|
||||||
Name, Email, PaymentDetails, EDate, sp, width, height, BannerURL, pid, ref_by, catid)
|
Name, Email, PaymentDetails, EDate, sp, width, height, BannerURL, pid, ref_by, catid)
|
||||||
VALUES (?,?,?,?,?,?,0,1,?,?,?,?,?,?,'',?,?,?,?,0,?)`,
|
VALUES (?,?,?,?,?,?,0,1,?,?,?,?,?,?,'',?,?,?,?,0,?)`,
|
||||||
[token, c.title || null, c.type === 'text' ? (c.body || null) : null, c.targetUrl,
|
// clicks route through our redirect so they count and carry the network site as the referrer
|
||||||
|
[token, c.title || null, c.type === 'text' ? (c.body || null) : null, 'https://instantadpay.com/api/ads/click/' + c.id,
|
||||||
assigned, assigned, now, kind.adtype,
|
assigned, assigned, now, kind.adtype,
|
||||||
opts.name || 'InstantAdPay member', opts.email || 'ads@instantadpay.com',
|
opts.name || 'InstantAdPay member', opts.email || 'ads@instantadpay.com',
|
||||||
'InstantAdPay campaign #' + c.id, edate,
|
'InstantAdPay campaign #' + c.id, edate,
|
||||||
@@ -107,6 +108,12 @@ async function deactivate(nasAdId) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// top up a syndicated ad with more impressions (buy-more-views / reactivate).
|
// top up a syndicated ad with more impressions (buy-more-views / reactivate).
|
||||||
|
// point an existing NAS ad at our click redirect (migration for rows pushed before 2026-09-10)
|
||||||
|
async function setClickUrl(nasAdId, campaignId) {
|
||||||
|
if (!enabled()) return { skipped: 'flag-off' };
|
||||||
|
await q('UPDATE sponsorads SET WebsiteURL=? WHERE ID=?', ['https://instantadpay.com/api/ads/click/' + Number(campaignId), Number(nasAdId)]);
|
||||||
|
return { ok: true };
|
||||||
|
}
|
||||||
async function topUp(nasAdId, addImpressions, days) {
|
async function topUp(nasAdId, addImpressions, days) {
|
||||||
if (!enabled()) return { skipped: 'flag-off' };
|
if (!enabled()) return { skipped: 'flag-off' };
|
||||||
await q(`UPDATE sponsorads SET assigned=assigned+?, remaining=remaining+?, approved=1,
|
await q(`UPDATE sponsorads SET assigned=assigned+?, remaining=remaining+?, approved=1,
|
||||||
@@ -115,4 +122,4 @@ async function topUp(nasAdId, addImpressions, days) {
|
|||||||
return { ok: true };
|
return { ok: true };
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = { enabled, pushCampaign, readServed, deactivate, topUp, impressionsPerCredit, nasKind };
|
module.exports = { setClickUrl, enabled, pushCampaign, readServed, deactivate, topUp, impressionsPerCredit, nasKind };
|
||||||
|
|||||||
Reference in New Issue
Block a user