Send Docusaurus page view events to Segment. This opens up your analytics possibilities to the over 300 different integrations that Segment provides.
npm install --save @twilio-labs/docusaurus-plugin-segment
Or, if you prefer Yarn:
yarn add @twilio-labs/docusaurus-plugin-segment
Accepted fields:
Name | Type | Default | Description |
---|---|---|---|
writeKey |
string |
Required | The Write Key for your Segment JavaScript source. |
trackLocalSearch |
boolean |
false |
Whether to track searches made with docusaurus-search-local |
allowedInDev |
boolean |
false |
Whether to allow tracking in development mode in addition to production. |
To find your write key:
- Login to Segment
- Click on Connections
- Open your JavaScript source. (If you don't have one, click Add Source to add one.)
- Choose the Settings tab
- Click API Keys
- You will find the Write Key on this page.
plugins: [
[
"@twilio-labs/docusaurus-plugin-segment",
{
writeKey: "3EBOWfRPv8qwertyZXCvbnMAsD2f1g0H",
allowedInDev: false,
},
],
],
Beyond sending page views to Segment, this plugin also supports sending search queries made using the docusaurus-search-local plugin.
It also supports identifying users on your system, should you have identity, by inspecting a cookie named client_id
and expecting it to have the format of <unique id>|<email>
(a unique identifier and email address, separated by the pipe character).
This plugin is leveraging Segment's Analytics.js 2.0 JavaScript client (called a "source").