Skip to main content

Configuration

All options are passed as the second element of the plugin tuple in your docusaurus.config.ts (or .js).

Options

OptionTypeRequiredDefaultDescription
domainstringYesThe domain of your website as configured in Plausible
customDomainstringNo"plausible.io"Custom domain for self-hosted Plausible instances
hashBasedRoutingbooleanNofalseEnable tracking for hash-based (#) routes
outboundLinksbooleanNofalseAutomatically track clicks on outbound (external) links
fileDownloadsboolean | FileDownloadsOptionsNofalseAutomatically track file downloads
taggedEventsbooleanNofalseTrack custom events on elements marked with data-analytics
revenuebooleanNofalseTrack ecommerce revenue
captureOnLocalhostbooleanNofalseEnable event tracking on localhost
manualPageviewsbooleanNofalseDisable automatic pageview tracking (pageviews sent by the plugin's client module)
compatbooleanNofalseUse the compatibility script for browsers that block the standard tracker
pageviewPropsbooleanNofalseAttach custom properties to every automatic pageview
excludePathsstring[]No[]Paths to exclude from tracking — each entry is a bare regex pattern
proxyApiEndpointstringNoOverride the API endpoint for sending events (sets data-api on the script tag)

fileDownloads object options

When fileDownloads is an object rather than true, you can control which extensions are tracked:

OptionTypeDescription
extensionsstring[]Replace the default extension list entirely (e.g. ["pdf", "zip"])
addExtensionsstring[]Add to the default extension list without replacing it

Default tracked extensions: pdf, xlsx, docx, txt, rtf, csv, exe, key, pps, ppt, pptx, 7z, pkg, rar, gz, zip, avi, mov, mp4, mpeg, wmv, midi, mp3, wav, wma, dmg.

TypeScript 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',
outboundLinks: true,
fileDownloads: {
addExtensions: ['sketch', 'fig'],
},
excludePaths: ['^/admin', '^/internal'],
} satisfies PluginOptions,
],
],
}

export default config