@twilio-labs/docusaurus-plugin-segment
TypeScript icon, indicating that this package has built-in type declarations

0.1.0 • Public • Published

docusaurus-plugin-segment

Send Docusaurus page view events to Segment. This opens up your analytics possibilities to the over 300 different integrations that Segment provides.

Installation

npm install --save @twilio-labs/docusaurus-plugin-segment

Or, if you prefer Yarn:

yarn add @twilio-labs/docusaurus-plugin-segment

Configuration

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:

  1. Login to Segment
  2. Click on Connections
  3. Open your JavaScript source. (If you don't have one, click Add Source to add one.)
  4. Choose the Settings tab
  5. Click API Keys
  6. You will find the Write Key on this page.

Example configuration

docusaurus.config.js

  plugins: [
    [
      "@twilio-labs/docusaurus-plugin-segment",
      {
        writeKey: "3EBOWfRPv8qwertyZXCvbnMAsD2f1g0H",
        allowedInDev: false,
      },
    ],
  ],

Other features

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).

About Segment

This plugin is leveraging Segment's Analytics.js 2.0 JavaScript client (called a "source").

Readme

Keywords

none

Package Sidebar

Install

npm i @twilio-labs/docusaurus-plugin-segment

Weekly Downloads

554

Version

0.1.0

License

MIT

Unpacked Size

20.2 kB

Total Files

19

Last publish

Collaborators

  • twilio-labs-ci