Send AuthKit events to your Segment destinations.
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.
To use the Add-on, your Authentication API Domain 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:
In the WorkOS Dashboard, click the Authentication icon in the sidebar. Then click Add-ons.
Click Enable next to Segment.
In another browser tab, visit Segment to get your credentials. Click Connections in the left sidebar.
Next to Sources, click Add more.
Under Choose a Source, search “HTTP API.” Below, click HTTP API. Then, in the lower right corner, click Next.
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.
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.
The Add-on sends events to Segment when certain WorkOS Events occur:
session.created
user.created
All names of events in Segment will match the names of the WorkOS 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.