TrustData
Tracking SDK

Event schema

Canonical reference for event types and payload fields across the JavaScript SDK and webhook API.

This is the single source of truth for TrustData's event schema. Both the JavaScript SDK and the webhook API use the same payload format — same field names, same objects, same structure.

Event types

SDK event nameWebhook topicDescription
purchasepurchaseCompleted transaction
generate_leadleadLead form submission
sign_upsignupAccount registration
page_viewPage view (SDK only)
refundOrder refunded (webhook only)
subscriptionSubscription started (webhook only)
(any name)customCustom event

Core fields

FieldTypeKeyDescription
Conversion IDstringconversion_idUnique ID for deduplication. Use your internal ID (order ID, lead ID, form submission ID, etc.). Always include this.
ValuenumbervalueConversion value. Decimal, not cents (e.g., 99.00).
CurrencystringcurrencyISO 4217 code (e.g., USD, EUR, GBP).

user_data object

User data is used for session matching and enhanced conversion forwarding to ad platforms (Meta CAPI, Google Ads, TikTok Events API). TrustData hashes all fields before sending to any platform.

// SDK
trustdata.push(['event', 'generate_lead', {
  conversion_id: 'lead_abc789',
  value: 50,
  currency: 'USD',
  user_data: {
    email: '[email protected]',
    phone: '+15551234567',
    first_name: 'Jane',
    last_name: 'Doe',
    address: {
      street: '123 Main St',
      city: 'New York',
      region: 'NY',
      postal_code: '10001',
      country: 'US'
    }
  }
}]);
// Webhook — identical structure
{
  "conversion_id": "lead_abc789",
  "value": 50,
  "currency": "USD",
  "user_data": {
    "email": "[email protected]",
    "phone": "+15551234567",
    "first_name": "Jane",
    "last_name": "Doe",
    "address": {
      "street": "123 Main St",
      "city": "New York",
      "region": "NY",
      "postal_code": "10001",
      "country": "US"
    }
  }
}

user_data fields

FieldTypeDescription
user_data.emailstringCustomer email
user_data.phonestringE.164 format (e.g., +15551234567)
user_data.first_namestring
user_data.last_namestring
user_data.address.streetstring
user_data.address.citystring
user_data.address.regionstringState or province
user_data.address.postal_codestringZIP or postal code
user_data.address.countrystringISO 3166-1 alpha-2 (e.g., US, FR)

products array

Line items for purchase events.

// SDK
trustdata.push(['event', 'purchase', {
  conversion_id: 'ORD-12345',
  value: 149.99,
  currency: 'USD',
  products: [
    {
      id: 'SKU123',
      name: 'Widget Pro',
      quantity: 2,
      price: 49.99,
    }
  ]
}]);
// Webhook — identical structure
{
  "conversion_id": "ORD-12345",
  "value": 149.99,
  "currency": "USD",
  "products": [
    {
      "id": "SKU123",
      "name": "Widget Pro",
      "quantity": 2,
      "price": 49.99
    }
  ]
}

products fields

FieldTypeDescription
idstringProduct identifier
namestringProduct display name
variant_idstringVariant identifier
skustringStock keeping unit
variant_titlestringVariant name (e.g., Blue / Large)
brandstringBrand name
categorystringProduct category
pricenumberUnit price
quantityintegerQuantity ordered
image_urlstringProduct image URL
urlstringProduct page URL

Consent state for the event. Include this when you have explicit user consent information.

// SDK
trustdata.push(['event', 'purchase', {
  conversion_id: 'ORD-12345',
  value: 149.99,
  currency: 'USD',
  consent: {
    analytics: true,
    advertising: true
  }
}]);
// Webhook — identical structure
{
  "conversion_id": "ORD-12345",
  "value": 149.99,
  "currency": "USD",
  "consent": {
    "analytics": true,
    "advertising": true
  }
}
FieldTypeDescription
consent.analyticsbooleanAnalytics and measurement consent
consent.advertisingbooleanAd targeting and remarketing consent
consent.preferencesbooleanFunctional / preferences consent
consent.sale_of_databooleanThird-party data sharing opt-out (CCPA)

Purchase fields

FieldTypeDescription
taxnumberTax amount
shippingnumberShipping cost
discount_codestringApplied discount or coupon code
discountnumberDiscount amount

Lead fields

FieldTypeDescription
lead_typestringLead category (e.g., demo_request, contact_form, newsletter)

Custom fields

Any additional fields are stored as event metadata. They don't affect attribution or conversion forwarding.


What to send for maximum accuracy

PriorityFieldWhy it matters
Criticalconversion_idPrevents double-counting
Criticalvalue + currencyRequired for ROAS and bidding signals
Highuser_data.emailSession matching and enhanced conversions
HighFull user_dataEnables enhanced conversions to Meta, Google, TikTok
MediumproductsProduct-level reporting and catalog matching
MediumconsentAccurate consent-aware attribution
LowCustom fieldsStored for analysis, not used for attribution