Skip to content

feat: count visits AI products send (AI referrals) - #48

Merged
cport1 merged 1 commit into
mainfrom
feat/ai-referrals
Sep 25, 2026
Merged

cport1 merged 1 commit into
mainfrom
feat/ai-referrals

Conversation

@cport1

@cport1 cport1 commented Sep 24, 2026

Copy link
Copy Markdown
Contributor

Companion to WebDecoy/app #1324 / #1325.

  • AIReferralCounter (src/referrals/): observes every protect() call; counts only GET navigations (Sec-Fetch-Mode: navigate, dest document or absent) whose Referer, or AI-naming utm_source/ref/utm_medium, names an AI product. Aggregates (platform, path) and sends {report_id, source: 'sdk', referrals} to POST /api/v1/sdk/ai-referrals every 60 s and on destroy(). A failed send keeps the batch and retries the same report_id (server dedupes); a 4xx is not retried.
  • Classifier is a port of the app's pkg/llmreferral; llm-platforms.generated.ts and llm-referral-vectors.generated.json are generated there, and the test replays all 79 vectors.
  • countAIReferrals config, default on with an API key. Nothing about the visitor (IP, UA, query, full referrer) is sent; a test asserts it.

jest: all packages pass (node 483); check:edge passes. Merge/release after the ingest endpoint is deployed.

With an API key, protect() counts GET document navigations whose Referer
(or, without one, whose campaign tags) names an AI product, by platform and
landing path, and sends the totals about once a minute. Aggregate only;
nothing about a visitor. A failed batch is retried under the same id, which
the server counts once. Opt out with countAIReferrals: false.

The platform table and the golden vectors this classifier replays are
generated from WebDecoy's own classifier.
@cport1
cport1 merged commit 679c800 into main Sep 25, 2026
2 checks passed
@cport1
cport1 deleted the feat/ai-referrals branch September 25, 2026 00:36
@cport1 cport1 mentioned this pull request Sep 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant