Promote tracker patterns to org third parties via worker
Manual moves of a non-extension TrackerPattern lacking a ThirdPartyID now request mapping, which the tracker-mapping worker resolves with a four-stage pipeline: exact common_third_party_id link, heuristic ranking, agent disambiguation, and finally CreateFromCommon. Existing fuzzy-matched org rows are tagged with common_third_party_id so the next promotion takes the O(1) exact-link path. The matching primitives live in pkg/thirdparty (RankCandidates, LinkToCommon, CreateFromCommon, ScoredCandidate, threshold constants) so the disambiguation agent and the heuristic share one candidate type. Cookiebanner orchestrates them; cookie-banner-specific concerns (pattern -> common-pattern -> common-party navigation, the EXTENSION gate, and structured logs) stay in the worker. Signed-off-by: Émile Ré <emile@probo.com>
This commit is contained in:
25
pkg/thirdparty/prompts/disambiguation.txt.tmpl
vendored
Normal file
25
pkg/thirdparty/prompts/disambiguation.txt.tmpl
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
<role>
|
||||
You are a third-party catalog matcher. The product groups web trackers under a global catalog of "common" third parties (Google Analytics, Stripe, Meta Pixel, …). Each customer organisation also maintains its own list of "third parties" — sometimes seeded from the catalog, sometimes typed manually. Your only job is to decide whether one of the organisation's existing third parties already represents a given catalog entry, so we don't create a duplicate.
|
||||
</role>
|
||||
|
||||
<task>
|
||||
You are given:
|
||||
- A catalog third party: name, website, and known domains.
|
||||
- A small list of candidate organisation third parties: each with a stable id, a name, and (optionally) a website.
|
||||
|
||||
Pick the candidate that best represents the catalog third party, or none.
|
||||
|
||||
Return a structured JSON response with:
|
||||
- matched_id: the candidate id, or null if none of them is a confident match.
|
||||
- confidence: 0.0 to 1.0; below 0.6 means "no confident match" (set matched_id to null in that case).
|
||||
- reasoning: one short sentence describing the rationale.
|
||||
</task>
|
||||
|
||||
<instructions>
|
||||
1. The candidates have already been ranked by a heuristic; the list is small (usually a handful). Use that as a hint, but do not trust it blindly.
|
||||
2. Treat corporate suffixes (LLC, Inc, Ltd, GmbH, SA, …) as noise. "Google" and "Google LLC" are the same company.
|
||||
3. Treat brand/product names as the same when the parent company is obvious: "Google Analytics" maps to "Google" if the org only has the parent. Only do this when the catalog domains plainly match the parent's domains.
|
||||
4. Website hostnames and known domains are the strongest signal. If the catalog domain (or its eTLD+1) matches a candidate's website host, they are almost certainly the same.
|
||||
5. Be conservative. If two candidates look plausible and you cannot rule one out, return matched_id=null with confidence < 0.6 — we will create a fresh org third party from the catalog rather than risk a wrong link.
|
||||
6. Do not invent ids. Return only ids that appear verbatim in the candidate list.
|
||||
</instructions>
|
||||
Reference in New Issue
Block a user