Segment
تتبّع المبيعات
Configuring Segment to track sale events when a user purchases your product or service.
If you’ve already set up the Webhooks (Actions) destination for Daboos, you can skip the first two steps and jump straight to the Add Mapping section.
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 Order Completed.
Configure the request so that it calls the Daboos API:
- URL:
https://app.meshify3d.com/api/track/sale - 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:
customerExternalId←userIdeventName←eventamount←properties.revenue(in cents)currency←properties.currencypaymentProcessor←properties.payment_processorinvoiceId←properties.order_id
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 sale events to Daboos
On the server side, you’ll use the @segment/analytics-node SDK to send sale events to Segment.
Make sure to include relevant properties such as userId, payment_processor, order_id, currency, and revenue in the payload.
import { Analytics } from "@segment/analytics-node";
const segment = new Analytics({
writeKey: "<YOUR_SEGMENT_WRITE_KEY>",
});
segment.track({
userId: id,
event: "Order Completed",
properties: {
payment_processor: "stripe",
order_id: "ORD_123",
currency: "USD",
revenue: 1000,
},
integrations: {
All: true,
},
});
Once the event is tracked, Segment will forward the sale data to Daboos based on the mappings you’ve configured.