Docusaurus

Last updated:

|Edit this page

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.js
module.exports = {
plugins: [
[
"posthog-docusaurus",
{
apiKey: "<ph_project_api_key>'",
appUrl: "<ph_instance_address>", // optional
enableInDevelopment: false, // optional
// other options are passed to posthog-js init as is
},
],
],
};

This will automatically start tracking pageviews, clicks and more.

For more instructions, see the browser JS library.

Questions?

Was this page useful?

Next article

Gatsby

Thanks to Ritesh Kadmawala for building this! GitHub: posthog/gatsby-plugin-posthog Gatsby behaves like a single-page app which means to track $pageview events special care is needed. This integration takes care of that. Install or How to use This will automatically start tracking pageviews, clicks and more. In your code you can access posthog via window.posthog . For more instructions, see browser JS library .

Read next article