Skip to content

Commit

Permalink
Update Docusaurus (#8512)
Browse files Browse the repository at this point in the history
  • Loading branch information
ivanagas committed May 24, 2024
1 parent 3956a82 commit 35f019c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 16 deletions.
22 changes: 11 additions & 11 deletions contents/docs/libraries/docusaurus.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -6,40 +6,40 @@ tags:
- community
---

> This is a community integration that is not maintained by the PostHog core team.
To easily track your Docusaurus site, you can install the [PostHog plugin](https://github.com/PostHog/posthog-docusaurus). This enables you to autocapture pageviews, clicks, session replays, as well as use the other features of PostHog such as [surveys](/docs/surveys).

## Install

Once you have your Docusaurus site set up, install the PostHog plugin:

```bash
yarn add posthog-docusaurus
npm install --save posthog-docusaurus
```

or
or

```bash
npm install --save posthog-docusaurus
yarn add posthog-docusaurus
```

## How to use
Next, add it to your Docusaurus config with your project API key and instance address, both of which you can find in [your project settings](https://us.posthog.com/settings/project).

```js
// in docusaurus.config.js
// docusaurus.config.js
module.exports = {
plugins: [
[
"posthog-docusaurus",
{
apiKey: "<ph_project_api_key>",
appUrl: "<ph_client_api_host>", // optional
appUrl: "<ph_client_api_host>", // optional, defaults to "https://us.i.posthog.com"
enableInDevelopment: 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.
Run your site again to see events autocaptured by PostHog.

For more instructions, see the [browser JS library](/docs/integrate/client/js).
> **Note:**You can pass additional PostHog [config options](/docs/libraries/js#config) to the plugin, but they are passed through `JSON.stringify()`, so functions (such as `sanitize_properties`) are not supported.
5 changes: 1 addition & 4 deletions src/navs/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1211,11 +1211,8 @@ export const docsMenu = {
url: '/docs/libraries/django',
},
{
name: 'Docusaurus v2',
name: 'Docusaurus',
url: '/docs/libraries/docusaurus',
badge: {
title: '3rd party',
},
},
{
name: 'Flask',
Expand Down
2 changes: 1 addition & 1 deletion src/pages/docs/frameworks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export const quickLinks = [
to: '/docs/libraries/django',
},
{
name: 'Docusaurus v2',
name: 'Docusaurus',
to: '/docs/libraries/docusaurus',
},
{
Expand Down

0 comments on commit 35f019c

Please sign in to comment.