---
title: Segment
description: Send AuthKit events to your Segment destinations.
icon: segment
showNextPage: true
originalPath: .tmp-workos-clone/packages/docs/content/authkit/add-ons/segment.mdx
---

## Introduction

The Segment AuthKit Add-on allows you to register AuthKit as a Segment source and receive events about logins, sign ups, and many other AuthKit activities. You can forward that data to your Segment destinations, allowing you to better understand the effectiveness of your marketing campaigns and your users' full journeys across your website and AuthKit.

---

## Configuring the Add-on

### (1) Confirm your domain

To use the Add-on, your [Authentication API Domain](/custom-domains/auth-api) must share the same root as the domain where you set up Segment through Analytics.js. This gives the Add-on access to your users' anonymous IDs, which the Add-on uses to identify users.

For example, if your Segment Analytics.js script lives at www.example.com:

- **Valid:** auth.example.com is a valid Authentication API Domain
- **Invalid:** auth.workos.com is not a valid Authentication API Domain

### (2) Visit the Add-ons page

In the WorkOS Dashboard, click the _Authentication_ icon in the sidebar. Then click _Add-ons_.

![Add-ons page in the Authentication section of the WorkOS Dashboard](https://images.workoscdn.com/images/d5b867bb-8f04-440b-8443-4f9a1026a0cb.png?auto=format&fit=clip&q=50)

### (3) Enable the Add-on

Click _Enable_ next to _Segment._

![Segment modal containing a Write Key field in the WorkOS Dashboard](https://images.workoscdn.com/images/18d3da6b-0b59-4973-8a71-851e1ad4e5dc.png?auto=format&fit=clip&q=50)

In another browser tab, visit Segment to get your credentials. Click _Connections_ in the left sidebar.

![Connections link in Segment](https://images.workoscdn.com/images/78899ff2-be15-4fc0-a9d4-1482af04703e.png?auto=format&fit=clip&q=50)

Next to _Sources_, click _Add more_.

![Add more link on the Connections page in Segment](https://images.workoscdn.com/images/5feab1ce-89d3-4998-b16e-9ffdb48b4b0f.png?auto=format&fit=clip&q=50)

Under _Choose a Source_, search "HTTP API." Below, click _HTTP API_. Then, in the lower right corner, click _Next._

![HTTP API source in Segment](https://images.workoscdn.com/images/c6be5d31-307f-4371-82de-9486a034f478.png?auto=format&fit=clip&q=50)

Under _Create your source_, give your source a name, like _WorkOS AuthKit Add-on_. Click _Create Source_. Under _Configure this source in your HTTP API codebase_, find your _Write Key_, and click the _Copy_ button next to it.

![Copy button next to a new Write Key for an HTTP API source in Segment](https://images.workoscdn.com/images/82093be1-5a27-4985-bdef-ce3899832ee6.png?auto=format&fit=clip&q=50)

Paste your write key in the _Write Key_ field in the WorkOS Dashboard. Click _Save changes_. The Segment AuthKit Add-on is enabled and will begin sending AuthKit events to Segment.

---

## Events sent to Segment

The Add-on sends events to Segment when certain [WorkOS Events](/events) occur:

- _Authentication_ events
- _Email verification_ events
- _Magic Auth_ events
- _Password reset_ events
- `session.created`
- `user.created`

All names of events in Segment will match the names of the [WorkOS Events](/events).

---

## Verifying events

After enabling the Add-on, visit your website, click your sign in button, and sign in to your application. Visit Segment and click _Connections_ in the sidebar. Click the source you created. Then click the _Debugger_ tab. You should see an identify call including your anonymous ID and a track call with an authentication event.

If you do not see an authentication event, visit the Add-ons page in the WorkOS Dashboard to verify your Write Key matches the value from Segment. If after confirming the values match you still need support, please reach out to us in Slack.
