Analytics
Plausible Analytics
Configure Plausible Analytics
Copy the script ID from your Plausible installation snippet. It is the part of
the pa-<id>.js file name. Sites that still use the legacy domain-based
snippet can pass domain instead of scriptId.
Register the scripts
Complete your framework quickstart first. Keep its Inth endpoint, policy, styles and consent UI. Remove the vendor's original script, SDK initializer or tag-manager entry, so the vendor loads only through c15t.
The vendor pages put the helper in src/consent-scripts.ts. If your framework
quickstart already has a scripts array, such as the one in c15t.config.ts
in the Next.js guide, add the helper to that array instead of creating a
second file.
The scripts export is a configuration, not an initializer. Add it to the c15t provider you already have, at the registration
point for your framework below. These are edits to that provider, not a second
provider.
Add the configuration to scripts in c15t.config.ts, next to
next.config.ts:
Keep the rest of your config, such as mode and routePrefix, in the
same call. ConsentRoot reads the config in the browser, so the layout
keeps passing only state. App Router, Pages Router and static export all
read the same file. See
Next.js scripts and embeds.
Options
| Option | Default | Behavior |
|---|---|---|
scriptId | None | Script ID for the pa-<scriptId>.js loader. Takes precedence over domain and extension. |
domain | None | Legacy site domain, set as data-domain. When neither scriptId nor domain has a non-empty value, the helper logs an error and the script does not load. |
extension | None | Legacy script extension or array of extensions, such as ['file-downloads', 'outbound-links']. The helper joins them into script.<extensions>.js. Ignored with scriptId. |
customProperties | None | Properties sent with each page view. |
endpoint | None | Custom event endpoint. With domain, the helper also sets it as data-api. |
fileDownloads | None | { fileExtensions?: string[] } for file download tracking. |
hashBasedRouting | None | true tracks hash-based routes. |
autoCapturePageviews | None | false stops automatic page views. |
captureOnLocalhost | None | true records visits on localhost. |
scriptUrl | https://plausible.io/js/pa-<scriptId>.js, or https://plausible.io/js/script.js with domain | Loader URL override. |
The helper passes customProperties, endpoint, fileDownloads,
hashBasedRouting, autoCapturePageviews and captureOnLocalhost as init
options on window.plausible.o, which the scriptId loader reads. With the
legacy loader, choose features with extension.
Loading and revocation
plausibleAnalytics uses the measurement category. When measurement becomes
allowed, the helper defines a queueing window.plausible stub, unless one
already exists, and then loads the tracker. Calls made before the tracker
finishes loading wait in the stub's queue.
On revocation the helper removes the script element and calls no Plausible API. Plausible sets no cookies, but c15t still waits for measurement permission before loading it.
Verify Plausible Analytics
After you allow measurement, the pa-<scriptId>.js request appears, or
script.js with your data-domain for the legacy loader. A page view request
then goes to plausible.io/api/event, or to your endpoint. After revocation
window.plausible still exists, so if your code sends custom events through
it, check measurement permission before each call.
Test in a private window with an opt-in policy. Open DevTools Network, disable the cache and filter by the vendor's domain:
- Load the page. No request goes to the vendor before you choose.
- Click Reject, then reload. There is still no vendor request.
- Open Privacy settings and allow the helper's category. The vendor script loads without a page reload.
- Turn the category off again and save. c15t reloads the page, and the new page makes no vendor request.
c15t reloads on revocation because removing a script element does not stop
code that already ran. The vendor's listeners, timers and queued events stay
alive until the page unloads. If you set reloadOnConsentRevoked: false, stop
the vendor yourself. Register a callback-only script whose onConsentChange
calls the vendor's opt-out API, as shown in
custom integrations, and check the
permission before each of your own event calls. The reload does not delete
cookies the vendor already set; see
clear on revocation for your framework.
The helper sets vendor to its script ID, so once you declare that vendor a
visitor can turn it off inside an allowed category. See
vendor consent for your framework. The
consent verification guide covers navigation,
expiry and hosting checks.