Segment
تتبّع العملاء المحتملين
Configuring Segment to track lead events when a new user signs up.
Step 1: Add a Webhooks (Actions) destination
In your Segment workspace, open the destinations catalog, search for Webhooks (Actions) and add the destination. Segment will use it to forward your events to the Daboos API.
Step 2: Configure the destination
In the Webhooks (Actions) destination settings, fill out the following fields:
- Name: Enter a name to help you identify this destination in Segment.
- Enable Destination: Toggle this on to allow Segment to send data to Daboos.
Once completed, click Save Changes.
Step 3: Add Mapping
Next, add a Send mapping and set its trigger to Event Name is Sign Up.
Configure the request so that it calls the Daboos API:
- URL:
https://app.meshify3d.com/api/track/lead - HTTP Method:
POST - Headers:
Authorization: Bearer dbs_xxxxxx(your Daboos API key) andContent-Type: application/json
In the Data section, map the event fields to the body the Daboos API expects:
clickId←context.traits.clickIdeventName←eventcustomerExternalId←userIdcustomerName←context.traits.namecustomerEmail←context.traits.emailcustomerAvatar←context.traits.avatar
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.
Step 4: Send lead events to Daboos
On the server side, you’ll use the @segment/analytics-node SDK to send lead events to Segment.
Make sure to include relevant user traits such as name, email, and clickId in the payload.
You’ll also need to ensure that the clickId field is properly mapped in your Webhooks (Actions) destination so that it’s forwarded correctly to Daboos.
import { Analytics } from "@segment/analytics-node";
const segment = new Analytics({
writeKey: "<YOUR_SEGMENT_WRITE_KEY>",
});
const cookieStore = await cookies();
const clickId = cookieStore.get("daboos_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 lead data to Daboos based on the mappings you’ve configured.