Beta. consent-kit is at 0.x: expect breaking changes between releases, and treat everything it generates as a draft. Report a problem or share feedback.
Add a vendor with a preset
Adopt a provider preset so that a third-party tool’s processor entry and artefacts are written for you, then adjust it to your setup and keep it up to date.
A preset is a versioned, sourced declaration of one tool. Check the catalogue first. If the tool is not there, write the entries by hand.
1. Decide the purpose
Section titled “1. Decide the purpose”A preset never chooses a lawful basis. You bind it to one of your own purposes, and the basis is the one that purpose declares.
For Plausible Analytics, the fixture registry has this purpose:
purposes: - id: analytics version: 1 basis: consent default: denied title: en: Visitor statistics de: Besucherstatistik description: en: Counts page views and referring sites, without cookies, to see which trip guides are read. de: Zählt Seitenaufrufe und verweisende Websites, ohne Cookies, um zu sehen, welche Reiseführer gelesen werden. dataCategories: [usage_events, ip_address] retention: 365d automatedDecisionMaking: false dataSubjects: [visitors]If the purpose does not exist yet, add it first.
2. Add the presets entry
Section titled “2. Add the presets entry”presets: - use: plausible version: 1 purpose: analytics with: script: pa-XXXXX.js| Line | Meaning |
|---|---|
use |
The preset id. |
version: 1 |
The newest 1.x.y in the catalogue. Write "1.0.0" to pin one exact version. |
purpose |
Your purpose id. A preset with several purpose slots takes purposes: { <slot>: <your id> } instead. |
with |
The preset’s parameters. For plausible, script is the file name of your site’s personalised script, from the snippet in your Plausible site settings. |
3. Check
Section titled “3. Check”npx consent-kit checkPresets: plausible@1.0.0 -> processor "plausible", artefacts plausible_script, plausible_event [DRAFT: not yet verified against the live vendor]
check passedThe line says which exact version was expanded and which ids it wrote. The draft flag is printed on every run for as long as the preset is a draft.
The entry expanded into a processor plausible and two artefacts: the script https://plausible.io/js/pa-XXXXX.js and the endpoint https://plausible.io/api/event, both bound to analytics. Everything downstream sees ordinary entries.
If you already declared the vendor by hand
Section titled “If you already declared the vendor by hand”A preset declares its tool completely, so nothing is merged:
privacy.registry.yaml:218:5 preset/id-collision Preset "plausible@1.0.0" declares the processor "plausible", but /processors/0 already uses that id. A preset declares its tool completely: remove the hand-written entry, or keep both by renaming the preset's: ids: { plausible: <another id> }.Remove your hand-written processor and its artefacts. If the registry was already released with them, see step 7.
If the basis is not what the preset expects
Section titled “If the basis is not what the preset expects”A preset slot may state the lawful basis its artefacts normally need. acme-analytics expects consent, because its tag stores a visitor id on the device. Binding such a slot to a purpose with another basis gives the warning preset/basis-mismatch. It is a warning, not an error: the basis is your decision. plausible expects none.
4. Put the script on the page
Section titled “4. Put the script on the page”A preset declares; it does not inject. Write the tag with the generated helper so that it waits for consent:
npx consent-kit script-tag plausible_script<script type="text/plain" data-category="analytics" data-service="plausible" data-src="https://plausible.io/js/pa-XXXXX.js"></script>Paste the tag into your HTML, or call consentScriptTag(registry, 'plausible_script') from the @consent-kit/cli package in your build script, as examples/static-site/src/build.ts does for its analytics tag. Add whatever initialisation the vendor’s snippet needs in your own bundle, not inline: the policy refuses inline scripts.
Then run npx consent-kit build. The policy now admits https://plausible.io in script-src and connect-src.
5. Adjust it
Section titled “5. Adjust it”Rename ids when the defaults clash with yours or with your conventions. A rename is not an override:
ids: { plausible_event: plausible_events }Exclude an artefact the preset documents but you do not use. This is recorded as an override:
exclude: [plausible_event]Override any field except id and kind, for example when you proxy Plausible through your own domain:
presets: - use: plausible version: 1 purpose: analytics with: { script: pa-XXXXX.js } ids: { plausible_event: plausible_events } overrides: artefacts: plausible_script: { src: /js/script.js } plausible_event: { url: /api/event }ids, exclude and overrides all refer to the preset’s default ids. null as a value removes an optional field.
Every override is shown, never hidden:
Presets: plausible@1.0.0 -> processor "plausible", artefacts plausible_script, plausible_events [DRAFT: not yet verified against the live vendor]Local overrides of preset defaults (2): artefact "plausible_script" src: "/js/script.js" here, "https://plausible.io/js/pa-XXXXX.js" in plausible@1.0.0; documented at https://plausible.io/docs/proxy/guides/nginx artefact "plausible_events" url: "/api/event" here, "https://plausible.io/api/event" in plausible@1.0.0; documented at https://plausible.io/docs/events-apiThe same list is printed at the end of the audit report. Overrides never fail the check; an overridden value is validated exactly like a hand-written one.
6. Audit
Section titled “6. Audit”npx consent-kit audit https://staging.example.comThis is the step that tells you whether the preset matches what the tool does on your site, today. If the vendor’s script sets a cookie the preset does not declare, “Undeclared drift” fails and prints the entry to add. Add it as a hand-written artefact with processor: plausible, and consider reporting it against the preset.
7. If you replace hand-written entries
Section titled “7. If you replace hand-written entries”The lock file stores the expanded registry, so diff compares what the preset expands to with what you released by hand. If both declare the same thing, there is no change at all.
If they differ, the differences are ordinary changes. Replacing the fixture’s hand-written Plausible entries with the preset gives:
Material (purpose version bump required): 2 artefact.target_changed@artefacts.plausible_script.src "https://plausible.io/js/script.js" -> "https://plausible.io/js/pa-XXXXX.js" analytics (consent): re-consent artefact.added@artefacts.plausible_event (none) -> {"id":"plausible_event","kind":"endpoint","url":"https://plausible.io/api/event","purposes":["ana... analytics (consent): re-consent
Needs confirmation (presumed not material): 1 processor.metadata_changed@processors.plausible.privacyUrl [not acknowledged] "https://plausible.io/data-policy" -> "https://plausible.io/privacy" analytics (consent): confirmation
Not material: 1 artefact.removed@artefacts.plausible_events {"id":"plausible_events","kind":"endpoint","processor":"plausible","purposes":["analytics"],"url"... -> (none) analytics (consent): changelog onlyTwo of these are artefacts of naming. The hand-written endpoint was called plausible_events and the preset calls it plausible_event: identity is by id, so that is a removal and a material addition. Keep your released id with ids: { plausible_event: plausible_events } and the pair disappears. The script URL really did change. Decide each one, then follow release a policy change.
8. Upgrade later
Section titled “8. Upgrade later”Preset versions follow semver with one rule on top: anything that would be a material change is a major version.
- With
version: 1you receive every1.x.ywhen you update the@consent-kit/presetspackage. None of them can, by itself, require asking your visitors again. - To move to a new major, change
version: 2, runconsent-kit diff, and treat the result like any other policy change.
After any package update, run consent-kit check. What a preset upgrade changed shows up as ordinary changes to ordinary artefacts.