Skip to content

Commit

Permalink
Updates to fully disable the segment plugin on dev builds
Browse files Browse the repository at this point in the history
This update conditionally removes the docusaurus-plugin-segment plugin for dev builds. A note with information about testing in production mode has also been added to the Contributing guidelines.
  • Loading branch information
vandan committed Dec 6, 2023
1 parent ec9a0e5 commit fc7abfd
Show file tree
Hide file tree
Showing 3 changed files with 813 additions and 815 deletions.
12 changes: 11 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -171,4 +171,14 @@ CodeSandbox entry point, and more complex code blocks that can be loaded directl
filesystem.
See the
[`remark-codesandbox` documentation](https://github.com/kevin940726/remark-codesandbox/#documentation)
for more information.
for more information.

## Analytics

The [`docusaurus-plugin-segment`](https://github.com/xer0x/docusaurus-plugin-segment) plugin enables simple usage analytics to inform documentation improvements that may be needed.

If you need to test analytics events in your local development enviorment be sure to export the appropriate key for the environment you are testing against before building and running the project:

```bash
export SEGMENT_ANALYTICS_KEY="<your key>"
```
4 changes: 3 additions & 1 deletion docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
const codeTheme = require("prism-react-renderer/themes/dracula");
const remarkCodesandbox = require("remark-codesandbox");
const path = require("path");
const isProd = process.env.NODE_ENV === 'production';

/** @type {import('@docusaurus/types').Config} */
const config = {
Expand Down Expand Up @@ -366,14 +367,15 @@ const config = {
},
},
],
isProd ?
[
"docusaurus-plugin-segment",
{
apiKey: process.env.SEGMENT_ANALYTICS_KEY,
load: {cookie: { sameSite: 'None', secure: true}},
page: true,
},
],
] : null,
],
themeConfig:
/** @type {import('@docusaurus/preset-classic').ThemeConfig} */
Expand Down
Loading

0 comments on commit fc7abfd

Please sign in to comment.