# Segment

> Learn how to add Segment analytics to your Fern documentation. Step-by-step guide to configure your Segment writeKey.

Integrate Segment to collect analytics and route user data to your preferred analytics destinations.

<Steps>
  <Step title="Get your Segment writeKey">
    In your Segment workspace, navigate to your Source, then go to **Settings > API Keys** and copy the **Write Key**.
  </Step>

  <Step title="Add Segment to `docs.yml`">
    In your `docs.yml` file, add the Segment writeKey:

    <CodeBlock title="docs.yml">
      ```yaml
      analytics:
        segment:
          write-key: ${SEGMENT_WRITE_KEY} # scans environment variable
      ```
    </CodeBlock>
  </Step>
</Steps>