Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docs: Update Docusaurus #8512

Merged
merged 1 commit into from
May 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading