Skip to main content

Self-Hosted Plausible

If you host Plausible yourself, use customDomain to load its script and proxyApiEndpoint to send events to a custom endpoint.

customDomain​

Sets the hostname used for the script URL and preconnect hint. It defaults to plausible.io.

{
domain: 'your-site.com',
customDomain: 'analytics.your-company.com',
}

This loads the script from:

https://analytics.your-company.com/js/plausible.js

proxyApiEndpoint​

Sets the script's data-api attribute so Plausible sends events to a custom endpoint. For example, you can route events through your own domain.

{
domain: 'your-site.com',
proxyApiEndpoint: 'https://your-site.com/api/event',
}

The script sends events to https://your-site.com/api/event instead of Plausible's default https://plausible.io/api/event. This changes the event endpoint, not the script URL.

Combined example​

import type { Config } from '@docusaurus/types'
import plausiblePlugin, { type PluginOptions } from '@homotechsual/docusaurus-plugin-plausible'

const config: Config = {
plugins: [
[
plausiblePlugin,
{
domain: 'your-site.com',
customDomain: 'analytics.your-company.com',
proxyApiEndpoint: 'https://your-site.com/api/event',
} satisfies PluginOptions,
],
],
}

export default config