This is a community integration that is not maintained by the PostHog core team.
Install
Terminal
yarn add posthog-docusaurus
or
Terminal
npm install --save posthog-docusaurus
How to use
JavaScript
// in docusaurus.config.jsmodule.exports = {plugins: [["posthog-docusaurus",{apiKey: "<ph_project_api_key>",appUrl: "<ph_client_api_host>", // optionalenableInDevelopment: false, // optional// other options are passed to posthog-js init as is// NOTE: options are passed through JSON.stringify(), so functions (such as `sanitize_properties`) are not supported.},],],};
This will automatically start tracking pageviews, clicks and more.
For more instructions, see the browser JS library.