Custom webhooks let you send conversion events (purchases, leads, sign-ups) to TrustData from your server, CRM, or any platform that can make HTTP requests.
Instead of relying on browser-side tracking, you POST a JSON payload to a TrustData endpoint. TrustData matches the event to a tracked session and attributes it to the correct ad campaign.
Once saved, the Endpoint, Webhook keys, and Recent activity sections appear below the form.
Backend prod, Shopify prod)Keys use the format td_wh_<random>. TrustData stores only the key prefix. The full key cannot be recovered after creation. If you lose the key, revoke it and generate a new one.
POST https://t.trustdata.tech/webhooks/custom/{attribution_id}/{topic}
| Path parameter | Description |
|---|---|
attribution_id | Your attribution ID from Settings → Attribution IDs |
topic | Event type (see table below) |
t.trustdata.tech.You can also send the topic in the X-Webhook-Topic header. The path value wins. A request with neither returns 400.
| Topic | Equivalent SDK event | Description | Forwarded to ad platforms |
|---|---|---|---|
purchase | purchase | Completed transaction | Yes |
generate_lead | generate_lead | Lead form submission | Yes |
lead | generate_lead | Older name for generate_lead, accepted as sent | Yes |
signup | sign_up | Account registration | Yes |
subscription | n/a | Subscription started | Yes |
custom | (any name) | Custom event | Yes |
refund | n/a | Order refunded | No |
order_update | n/a | A change to an existing order | No |
qualify_lead | n/a | Later lead stage | No |
working_lead | n/a | Later lead stage | No |
close_convert_lead | n/a | Later lead stage | No |
close_unconvert_lead | n/a | Later lead stage | No |
disqualify_lead | n/a | Later lead stage | No |
TrustData stores every topic in the list. A topic in the last column is never sent to an ad platform. A topic outside the list is accepted but stored without the fields TrustData reads from the payload, and is not forwarded.
Forwarding to an ad platform also needs consent.advertising set to true and a non-empty conversion_id. See Consent.
Send a webhook key or a signature. A request with neither returns 401.
| Header | Value |
|---|---|
Authorization | Bearer td_wh_... |
Content-Type | application/json |
The Authorization header also accepts the key without the Bearer prefix. A key works only for the attribution ID it was generated for. A key for another attribution ID returns 403. If the key has an IP allowlist, a request from another address returns 401.
Instead of a key, you can sign the request body with your property's webhook signing secret.
| Header | Value |
|---|---|
X-Webhook-Signature | HMAC-SHA256 of the raw request body, hex or base64 encoded |
Content-Type | application/json |
A sha256= prefix on the signature is accepted. TrustData creates the signing secret when you turn on Accept incoming webhooks. The dashboard does not display it. If the property has no secret, the request returns 401 with no signing secret configured.
SIGNATURE=$(printf '%s' "$PAYLOAD" | openssl dgst -sha256 -hmac "$SECRET" | cut -d' ' -f2)
curl -X POST \
https://t.trustdata.tech/webhooks/custom/YOUR_ATTRIBUTION_ID/purchase \
-H "X-Webhook-Signature: sha256=$SIGNATURE" \
-H "Content-Type: application/json" \
-d "$PAYLOAD"
The webhook payload uses the same schema as the JavaScript SDK, with the same field names and the same objects. See the Event schema for the full reference.
A minimal purchase example:
{
"conversion_id": "ORD-12345",
"value": 149.99,
"currency": "USD",
"user_data": {
"email": "customer@example.com"
}
}
A complete purchase with all signals:
{
"conversion_id": "ORD-12345",
"value": 149.99,
"currency": "USD",
"tax": 12.50,
"shipping": 5.99,
"discount_code": "SUMMER20",
"user_data": {
"email": "customer@example.com",
"phone": "+15551234567",
"first_name": "Jane",
"last_name": "Doe",
"address": {
"city": "New York",
"region": "NY",
"postal_code": "10001",
"country": "US"
}
},
"items": [
{
"item_id": "SKU123",
"item_name": "Widget Pro",
"quantity": 2,
"price": 49.99
}
],
"consent": {
"analytics": true,
"advertising": true
}
}
| Field | Type | Description |
|---|---|---|
conversion_id | string | Your identifier for the conversion. You can send transaction_id instead. An empty value blocks forwarding to ad platforms |
event_id | string | Optional. TrustData builds the event ID it returns and forwards as custom_<event_id>. Without it, the ID is custom_<conversion_id> |
event_time | number or string | Unix seconds or an RFC 3339 string. If absent, zero or negative, TrustData uses the time it received the request. A future time becomes the receive time |
value | number | Conversion value. On the refund topic a positive value becomes negative |
currency | string | ISO 4217 code. TrustData converts it to uppercase |
visitor_id | string | The SDK visitor ID, used for session matching |
consent | object | analytics, advertising, preferences and sale_of_data, each a boolean. See Consent |
user_data | object | email, email_sha256, phone, first_name, last_name and address (street, city, region, postal_code, country) |
items | array | One object per product. Each item takes item_id, item_name, price, quantity and the other item fields. The older names products, id and name are still accepted |
email_sha256 is the lowercase hex SHA-256 of the lowercased, trimmed email address. TrustData ignores a value that is not a 64-character hex digest. Send numbers as JSON numbers: a number sent as a string is ignored.
Any other top-level key is stored as a field of the order.
An absent consent object sets every flag to false. TrustData records the conversion, its value and its attribution whatever the consent. The flags change what else it keeps:
advertising, TrustData drops the plaintext user_data and the raw payload, and forwards nothing to ad platforms.analytics and without advertising, TrustData keeps user_data.email_sha256 if you sent one. It does not hash a plaintext email.user_data.Send the real consent state on every request.
curl -X POST \
https://t.trustdata.tech/webhooks/custom/YOUR_ATTRIBUTION_ID/purchase \
-H "Authorization: Bearer td_wh_your_key_here" \
-H "Content-Type: application/json" \
-d '{
"conversion_id": "ORD-12345",
"value": 149.99,
"currency": "USD",
"user_data": {
"email": "customer@example.com",
"phone": "+15551234567"
},
"consent": { "analytics": true, "advertising": true }
}'
curl -X POST \
https://t.trustdata.tech/webhooks/custom/YOUR_ATTRIBUTION_ID/lead \
-H "Authorization: Bearer td_wh_your_key_here" \
-H "Content-Type: application/json" \
-d '{
"conversion_id": "lead_abc789",
"value": 50,
"currency": "USD",
"lead_type": "demo_request",
"user_data": {
"email": "prospect@example.com"
},
"consent": { "analytics": true, "advertising": true }
}'
TrustData links the incoming webhook to a browser session it has already tracked. The session match is what ties the conversion back to the ad click that drove it.
Matching uses visitor_id, the anonymous ID the JavaScript SDK assigns to the visitor. Pass it from your frontend to your backend when a conversion occurs.
// Frontend: get the visitor ID at checkout
const visitorId = trustdata.getVisitorId();
// Pass visitorId to your backend with the order
{
"conversion_id": "ORD-12345",
"visitor_id": "the-id-from-getVisitorId",
"value": 149.99,
"currency": "USD"
}
TrustData uses user_data (email, phone) for enhanced conversion forwarding to ad platforms, not for session matching.
When TrustData finds a match, it attributes the conversion to the campaign and forwards it to ad platforms.
The Recent activity section in the Receiving tab shows the last 20 requests:
| Column | Description |
|---|---|
| Event | The topic you sent, when it arrived, and the source (for example custom or woocommerce) |
| Status | The HTTP status code TrustData returned (200, 401, 429…) |
| IP | The IP address the request came from |
A successful request returns 200 with this body:
{
"success": true,
"matched": true,
"event_id": "custom_ORD-12345",
"visitor_id": "the-id-from-getVisitorId",
"session_id": "",
"conversion_forwarded": true
}
Every error body is {"success": false, "error": "<message>"}.
success in every response. If TrustData accepts the request but fails while saving the conversion, it still returns HTTP 200, with {"success": false, "error": "..."}. A client that reads only the status code treats a dropped conversion as delivered.| Status | Cause |
|---|---|
400 | The URL has no attribution ID or no topic, or the body is not valid JSON |
401 | The webhook key is unknown, revoked or expired. Or the request has neither a key nor a signature. Or the signature does not match. Or the property has no signing secret |
403 | The webhook key belongs to another attribution ID |
405 | The method is not POST |
429 | Too many requests from your IP address. The response carries a Retry-After header |
An attribution ID that does not exist returns 403 when you send a webhook key and 401 when you send a signature. The collector does not check whether Accept incoming webhooks is on.
TrustData limits requests per IP address. A request over the limit returns 429 with a Retry-After header. No limit applies per webhook key.
401 UnauthorizedAuthorization: Bearer td_wh_...X-Webhook-Signatureno signing secret configured means the property has no signing secret. Turn on Accept incoming webhooks and save, or send a webhook key403 Forbidden429 Too Many RequestsRetry-After period, then retry200 status means TrustData received the event. If it is still not attributed, TrustData did not link it to a visitorvisitor_id, the primary matching signal (use trustdata.getVisitorId())