feat: count visits AI products send (AI referrals) - #48
Merged
Merged
Conversation
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.
Merged
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.
Companion to WebDecoy/app #1324 / #1325.
AIReferralCounter(src/referrals/): observes everyprotect()call; counts only GET navigations (Sec-Fetch-Mode: navigate, dest document or absent) whose Referer, or AI-namingutm_source/ref/utm_medium, names an AI product. Aggregates (platform, path) and sends{report_id, source: 'sdk', referrals}toPOST /api/v1/sdk/ai-referralsevery 60 s and ondestroy(). A failed send keeps the batch and retries the samereport_id(server dedupes); a 4xx is not retried.pkg/llmreferral;llm-platforms.generated.tsandllm-referral-vectors.generated.jsonare generated there, and the test replays all 79 vectors.countAIReferralsconfig, 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:edgepasses. Merge/release after the ingest endpoint is deployed.