# 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.

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](/docs/manual/reference/presets/#catalogue) first. If the tool is not there, [write the entries by hand](/docs/manual/guides/write-a-registry-entry/).

> [!WARNING]
> A preset saves typing. It does not make the declaration true. The `plausible` preset is a draft: its facts were read on the vendor's documentation, nothing has been observed in a browser, and its fixture has never been run. Always audit your own site after adopting a preset.

## 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:

```yaml
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

```yaml
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

```sh
npx consent-kit check
```

```
Presets:
  plausible@1.0.0 -> processor "plausible", artefacts plausible_script, plausible_event  [DRAFT: not yet verified against the live vendor]

check passed
```

The 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

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](#7-if-you-replace-hand-written-entries).

### 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

A preset declares; it does not inject. Write the tag with the generated helper so that it waits for consent:

```sh
npx consent-kit script-tag plausible_script
```

```html
<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

**Rename ids** when the defaults clash with yours or with your conventions. A rename is not an override:

```yaml
    ids: { plausible_event: plausible_events }
```

**Exclude** an artefact the preset documents but you do not use. This is recorded as an override:

```yaml
    exclude: [plausible_event]
```

**Override** any field except `id` and `kind`, for example when you proxy Plausible through your own domain:

```yaml
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-api
```

The 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

```sh
npx consent-kit audit https://staging.example.com
```

This 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

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 only
```

Two 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](/docs/manual/guides/release-a-policy-change/).

## 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: 1` you receive every `1.x.y` when you update the `@consent-kit/presets` package. None of them can, by itself, require asking your visitors again.
- To move to a new major, change `version: 2`, run `consent-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.

## Related

- [Presets reference](/docs/manual/reference/presets/)
- [Contribute a preset](/docs/manual/guides/contribute-a-preset/)
