Ads by API token and CLI: campaigns, publisher slots, and ad visits in stats - #235
Merged
Conversation
…CLI, and ad visits in stats POST/GET /api/ads/v1/campaigns creates a campaign from a URL for a bearer token caller: the page is read, the creatives written, the campaign saved active. A live campaign for the same URL is returned instead of a twin. POST/GET /api/ads/v1/slots creates a publisher slot on a site named by hostname, finding or creating the site's project with the tracker on, and answers with the two tags to paste. The CLI gains `ads create|list` and `slots create|list` over the same endpoints, with CRAWLPROOF_TOKEN. The tracker now buckets a visit that arrived through an ad as ad:<ref>: our click redirect appends ?ref=crawlproof-ad-NNN to the destination, and paid utm tags name their source. Bots stay bots; the referrer no longer hides a paid visit behind the page that carried the unit. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YafYxayh7Gqe5MWNNQMev2
ThreatCrush Security Scan39 finding(s) HIGH/CRITICAL: 2 | MEDIUM: 28 | LOW: 9
Snippets are redacted; ThreatCrush never prints matched credential material. |
| } else if (enableTracking && project.tracker_enabled === false) { | ||
| await sb.from("projects").update({ tracker_enabled: true }).eq("id", project.id).eq("owner_id", userId); | ||
| } | ||
| if (!project) return { ok: false, status: 500, error: "Failed to resolve the site." }; |
This was referenced Sep 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
POST/GET /api/ads/v1/campaigns— a campaign from a URL for acrp_bearer caller: page read, creatives written, saved active (orstatus: "draft"). A live campaign for the same URL is returned withexisting: trueinstead of a twin. Optional columns (org, summaries) degrade the same waysaveCampaigndoes.POST/GET /api/ads/v1/slots— a publisher slot on a site named by hostname or URL. The site's project is found by host or created with the tracker on; the response carriesembed(unit + stats.js + ad.js) andtracker.crawlproof ads create <url> [--name --budget --bid --draft --json],ads list,slots create <site> [--placement --format --formats --inactive --no-tracking --json],slots list, withCRAWLPROOF_TOKEN/--token.categorize()takes the landing URL and bucketsad:crawlproof-ad-NNN(our click redirect's?ref=) orad:<utm_source>for paid utm tags / gclid / msclkid, ahead of the referrer. Bots stay bots.bucketLabelrendersAd · ….Callers: the myna
crawlproofplugin (mynaposter 0.6.0) opens a campaign for every blog post it publishes through this endpoint.Tests
14 new (request parsing, clamps, embed tags, CLI bodies, ad bucketing); full suite 2065 pass.
🤖 Generated with Claude Code
https://claude.ai/code/session_01YafYxayh7Gqe5MWNNQMev2