Skip to Content

// snippet import removed // snippet import removed // snippet import removed // snippet import removed

💡

This feature is only available on Business plans and above .

Dub’s Segment integration  provides a bi-directional sync between your Segment workspace and Dub. There are 2 parts to the integration:

In this guide, we will be focusing on using the Dub (Actions) Destination  to track conversion events directly from Segment.

Configure Segment Action

Next, configure Segment Dub (Actions)  to track sales conversion events.

Add Dub (Actions) destination

Head to Segment Dub (Actions)  and add the destination to your Segment workspace.

Segment Dub (Actions) destination

Configure Dub API Key

In the Dub (Actions) destination settings, fill out the following fields:

  • Name: Enter a name to help you identify this destination in Segment.
  • API Key: Enter your Dub API key. You can find this in the Dub Dashboard .
  • Enable Destination: Toggle this on to allow Segment to send data to Dub.

Once completed, click Save Changes.

Segment Dub (Actions) Basic Settings

Add Mapping

Next, depending on the event you want to track, choose the corresponding action from the list of available actions:

Event to trackDefault event nameExample
LeadSign UpA user signs up for an account
SaleOrder CompletedA user purchases a product

Segment Dub (Actions) Mapping

Below the selected action, you’ll see the mapping for that action.

Segment Dub (Actions) Mapping

You can customize the trigger and mapping to fit the specific needs of your application.

Finally, click Next and then Save and enable to add the mapping to the destination.

Send conversion events to Dub

On the server side, you’ll use the @segment/analytics-node SDK to send conversion events to Segment.

Make sure to include relevant properties in the payload:

import { Analytics } from "@segment/analytics-node"; const segment = new Analytics({ writeKey: "<YOUR_SEGMENT_WRITE_KEY>", }); const cookieStore = await cookies(); const clickId = cookieStore.get("dub_id")?.value; segment.track({ userId: id, event: "Sign Up", context: { traits: { name, email, avatar, clickId, }, }, integrations: { All: true, }, });

Once the event is tracked, Segment will forward the conversion data to Dub based on the mappings you’ve configured.

Supported attributes

View conversion results

And that’s it – you’re all set! You can now sit back, relax, and watch your conversion revenue grow. We provide 3 different views to help you understand your conversions:

Example apps

github

Segment + Next.js App Router Example

Next.js app using Segment to track sales.