This is the single source of truth for TrustData's event schema. The JavaScript SDK and the webhook API share field names, objects and structure. They differ in who sets identity and consent. The SDK sets visitor_id, user_id and consent itself, and discards any value you pass for them in event(). In a webhook you send all three in the payload. The sections below say where the two differ.
| SDK event name | Webhook topic | Description |
|---|---|---|
purchase | purchase | Completed transaction |
generate_lead | generate_lead or lead | Lead form submission. lead is the older topic name and stays accepted |
sign_up | signup | Account registration |
page_view | n/a | Page view (SDK only) |
page_leave, user_engagement | n/a | Engagement events sent automatically by the SDK |
identity_link | n/a | Sent by linkIdentity() after a consent upgrade (SDK only) |
consent_decision | n/a | Sent automatically when consent() is called with { interaction: true } (SDK only) |
funnel_step | n/a | A funnel step, sent from the GTM template |
| n/a | order_update | A change to an earlier order (webhook only) |
| n/a | qualify_lead, working_lead, close_convert_lead, close_unconvert_lead, disqualify_lead | Later lead stages (webhook only) |
| n/a | refund | Order refunded (webhook only) |
| n/a | subscription | Subscription started (webhook only) |
| (any name) | custom | Custom event |
TrustData stores order_update, refund and the later lead stages but never forwards them to an ad platform.
| Field | Type | Key | Description |
|---|---|---|---|
| Conversion ID | string | conversion_id | Unique ID for deduplication. Use your internal ID (order ID, lead ID, form submission ID, etc.). transaction_id is read as a fallback. |
| Value | number | value | Conversion value. Decimal, not cents (e.g., 99.00). |
| Currency | string | currency | ISO 4217 code (e.g., USD, EUR, GBP). |
The collector does not reject an event without conversion_id. It stores the event, but it does not forward it to an ad platform. Forwarding also needs advertising consent on the event.
user_data objectTrustData uses user data for session matching and enhanced conversion forwarding to ad platforms (Meta CAPI, Google Ads, TikTok Events API). It hashes all fields before sending them to any platform.
// SDK: set the user once, the SDK hashes email and phone and adds them to later events
trustdata.setUser({
email: 'customer@example.com',
phone: '+15551234567',
first_name: 'Jane',
last_name: 'Doe',
address: {
street: '123 Main St',
city: 'New York',
region: 'NY',
postal_code: '10001',
country: 'US'
}
});
trustdata.push(['event', 'generate_lead', {
conversion_id: 'lead_abc789',
value: 50,
currency: 'USD'
}]);
// Webhook: same structure, sent in the payload
{
"conversion_id": "lead_abc789",
"value": 50,
"currency": "USD",
"user_data": {
"email": "customer@example.com",
"phone": "+15551234567",
"first_name": "Jane",
"last_name": "Doe",
"address": {
"street": "123 Main St",
"city": "New York",
"region": "NY",
"postal_code": "10001",
"country": "US"
}
}
}
How the SDK and the collector treat user_data:
setUser(). The SDK hashes email and phone with SHA-256 in the browser and adds the stored data to every event as user_data. It does so only while the visitor has advertising consent. This data replaces any user_data you pass in event().user_data in event(). Without a prior setUser(), the SDK sends your user_data as written. It does not hash it. Prefer setUser().user_data only when the event has advertising consent, and drops it otherwise. A value that is a SHA-256 hex digest is kept as a digest. Any other email or phone is read as plain text.user_data from a webhook as well. It keeps only an email hash you supplied, and only when the event has analytics consent.user_data fields| Field | Type | Description |
|---|---|---|
user_data.email | string | Customer email |
user_data.phone | string | E.164 format (e.g., +15551234567) |
user_data.first_name | string | |
user_data.last_name | string | |
user_data.address.street | string | |
user_data.address.city | string | |
user_data.address.region | string | State or province |
user_data.address.postal_code | string | ZIP or postal code |
user_data.address.country | string | ISO 3166-1 alpha-2 (e.g., US, FR) |
items arrayLine items for purchase events.
// SDK
trustdata.push(['event', 'purchase', {
conversion_id: 'ORD-12345',
value: 149.99,
currency: 'USD',
items: [
{
item_id: 'SKU123',
item_name: 'Widget Pro',
quantity: 2,
price: 49.99,
}
]
}]);
// Webhook: same structure
{
"conversion_id": "ORD-12345",
"value": 149.99,
"currency": "USD",
"items": [
{
"item_id": "SKU123",
"item_name": "Widget Pro",
"quantity": 2,
"price": 49.99
}
]
}
items fields| Field | Type | Description |
|---|---|---|
item_id | string | Product identifier. Required |
item_name | string | Product display name. Required |
price | number | Unit price, greater than 0. Required |
quantity | integer | Quantity ordered. Defaults to 1 |
currency | string | ISO 4217 code, if it differs from the event currency |
variant_id | string | Variant identifier |
sku | string | Stock keeping unit |
item_variant | string | Variant name (e.g., Blue / Large) |
item_brand | string | Brand name |
item_category | string | Product category |
categories | array of strings | Category path, for example ["Apparel", "Shoes"] |
image_url | string | Product image URL |
url | string | Product page URL |
TrustData skips an item that is missing item_id, item_name, or a positive price. The exception is an item that carries a ref, which TrustData keeps without them. Any other field you add to an item is kept as a custom item field.
Other fields TrustData reads on an item: discount, cost and compare_at_price.
Older names. TrustData still accepts the names it used before: products for the list, and id, name, brand, category, variant_title and total_discount on each item. If an item carries both spellings, the name in the table wins. Use the names in the table in new code.
consent objectConsent state for the event. Where you set it depends on the channel.
SDK. Set consent with trustdata.consent() or the consent option of init. The SDK adds the consent object to every event from that state. A consent value passed to event() is discarded.
// SDK
trustdata.consent({ analytics: true, advertising: true });
trustdata.push(['event', 'purchase', {
conversion_id: 'ORD-12345',
value: 149.99,
currency: 'USD'
}]);
Webhook. Send the consent object in the payload. If you leave it out, the collector treats all four levels as false.
{
"conversion_id": "ORD-12345",
"value": 149.99,
"currency": "USD",
"consent": {
"analytics": true,
"advertising": true
}
}
consent fields| Field | Type | Description |
|---|---|---|
consent.analytics | boolean | Analytics and measurement consent |
consent.advertising | boolean | Ad targeting and remarketing consent |
consent.preferences | boolean | Functional / preferences consent |
consent.sale_of_data | boolean | Third-party data sharing opt-out (CCPA) |
| Field | Type | Description |
|---|---|---|
tax | number | Tax amount |
shipping | number | Shipping cost |
discount_code | string | Applied discount or coupon code |
discount | number | Discount amount |
| Field | Type | Description |
|---|---|---|
lead_type | string | Lead category (e.g., demo_request, contact_form, newsletter) |
TrustData stores any additional fields as event metadata. They don't affect attribution or conversion forwarding.
| Priority | Field | Why it matters |
|---|---|---|
| Critical | conversion_id | Prevents double-counting |
| Critical | value + currency | Required for ROAS and bidding signals |
| High | user_data.email | Session matching and enhanced conversions |
| High | Full user_data | Enables enhanced conversions to Meta, Google, TikTok |
| Medium | items | Product-level reporting and catalog matching |
| Medium | consent | Accurate consent-aware attribution |
| Low | Custom fields | Stored for analysis, not used for attribution |