TrustData
Tracking

Events reference

Track page views and conversions with TrustData.

TrustData tracks two types of events: page views and conversions.

Page views

The SDK tracks page views automatically when you initialize it with sendPageView: true:

trustdata.push(['init', 'YOUR_ATTRIBUTION_ID', { sendPageView: true }]);

Each page view captures:

  • Current URL and referrer
  • UTM parameters
  • TrustData tracking parameters
  • Click IDs from ad platforms
  • Visitor and session identifiers
  • Consent and adblock status

Alongside page_view, the SDK emits these events automatically (no code required):

EventWhen it fires
page_leaveWhen the visitor navigates away or closes the tab
user_engagementOnce the page has been visible for the engagement timer (10 seconds by default)
identity_linkWhen linkIdentity() links a pre-consent fingerprint to the new visitor ID after a consent upgrade
consent_decisionWhen your code calls consent() with { interaction: true }, after a real choice in your consent banner
rage_clickWhen a visitor clicks three or more times within one second and 30 pixels. Carries a selector and a click_count
dead_clickWhen a click on a link or button changes neither the page content nor the URL within one second. Carries a selector

The SDK sends rage_click and dead_click only with analytics consent. The selector is built from tag names, ids and class names of the clicked element and up to three parents. The SDK never reads the element's text, value, link or label. It sends at most five of these events per page.

page_leave and user_engagement carry an engagement_time_msec value so you can measure real attention rather than raw pageviews. To change the engagement timer (10 to 60 seconds), open Settings → Attribution IDs, select the attribution ID, and edit Engagement timer (seconds) in the Delivery tab.

If you install through Google Tag Manager, the template can also send funnel_step events for each step of a funnel.

Single page applications (SPAs)

For SPAs (React, Vue, etc.), track page views on route changes:

// After route change
trustdata.push(['event', 'page_view']);

Conversions

Conversions are the events that matter for attribution. TrustData supports two primary conversion types:

Purchase

For e-commerce transactions:

trustdata.push(['event', 'purchase', {
  conversion_id: 'ORD-12345',  // Your order ID, used for deduplication and forwarding
  value: 149.99,
  currency: 'USD',
}]);

Full example with items:

trustdata.push(['event', 'purchase', {
  conversion_id: 'ORD-12345',
  value: 149.99,
  currency: 'USD',
  tax: 12.50,
  shipping: 5.99,
  items: [
    {
      item_id: 'SKU123',
      item_name: 'Premium Widget',
      quantity: 2,
      price: 49.99,
    },
    {
      item_id: 'SKU456',
      item_name: 'Widget Accessory',
      quantity: 1,
      price: 50.01,
    },
  ],
}]);

Generate lead

For lead generation (demo requests, form submissions, signups):

trustdata.push(['event', 'generate_lead', {
  conversion_id: 'lead_abc789',
  value: 50,
  currency: 'USD',
  lead_type: 'demo_request',
}]);

Examples:

// Demo request
trustdata.push(['event', 'generate_lead', {
  conversion_id: 'lead_abc789',
  value: 100,
  currency: 'USD',
  lead_type: 'demo_request',
}]);

// Newsletter signup
trustdata.push(['event', 'generate_lead', {
  conversion_id: 'sub_xyz123',
  value: 10,
  currency: 'USD',
  lead_type: 'newsletter',
}]);

// Contact form
trustdata.push(['event', 'generate_lead', {
  conversion_id: 'form_456',
  value: 50,
  currency: 'USD',
  lead_type: 'contact_form',
}]);

Customer data

To send an email address or phone number for enhanced conversions, call trustdata.setUser() once, for example after a visitor logs in. The SDK hashes the values in the browser and adds them to later events, but only when the visitor has advertising consent. See JavaScript SDK.

URL parameters

The SDK sends the page URL. The event server reads the URL parameters from it and uses them for attribution.

TrustData parameters

Add these to your ad URLs for campaign tracking:

ParameterPurposeExample
trdt_cpidCampaign ID?trdt_cpid={campaignid}
trdt_agidAd Group ID&trdt_agid={adgroupid}
trdt_kwidKeyword ID&trdt_kwid={targetid}
trdt_ctidCreative/Ad ID&trdt_ctid={creative}

Example URL:

https://example.com/landing?trdt_cpid=123&trdt_agid=456&trdt_ctid=789

UTM parameters

TrustData captures standard UTM parameters automatically:

ParameterPurpose
utm_sourceTraffic source (google, facebook, newsletter)
utm_mediumMarketing medium (cpc, email, social)
utm_campaignCampaign name
utm_termPaid search keyword
utm_contentAd variation or link identifier

Ad platform click IDs

Ad platforms add these automatically:

ParameterPlatform
gclid, gbraid, wbraidGoogle Ads
dclidGoogle Display & Video 360 / Campaign Manager 360
fbclidMeta Ads
ttclidTikTok Ads
msclkidMicrosoft Ads
li_fat_idLinkedIn Ads
twclidX (Twitter) Ads
rdt_cidReddit Ads
epikPinterest Ads

If the visitor consents, TrustData captures these click IDs and uses them to match conversions to the original ad click.

Automatically captured data

Every event includes:

FieldDescription
event_timeEvent time (Unix seconds)
page_locationCurrent page URL
page_referrerReferring URL
visitor_idPersistent visitor identifier (omitted when analytics consent is not granted)
raw_user_agentUser agent string, parsed server-side into browser, OS, and device
consentConsent state (4 levels)
adblock_detected / adblock_platforms_blockedWhether an ad blocker is active, and which platforms it blocks as a comma-separated list
Consent-aware capture. Without analytics consent, the SDK does not store a visitor ID. The server strips personal data: it drops visitor_id and user_id, removes user_data, and masks click IDs (gclid, fbclid, and similar) from the URL. The SDK uses a short-lived fp_ fingerprint instead, so anonymous traffic still counts.
For the full payload reference, see the Event schema. It lists all fields and objects, and what to prioritize for maximum accuracy.

Best practices

1. Always include conversion_id

Include a unique conversion_id on every conversion event to prevent duplicate attribution. The collector stores an event that has no conversion_id, but it does not forward that event to ad platforms:

trustdata.push(['event', 'purchase', {
  conversion_id: 'ORD-12345',  // your order ID, lead ID, form ID, etc.
  value: 149.99,
  currency: 'USD',
}]);

2. Always include value

Attribution depends on conversion value. Always include it:

// Good
trustdata.push(['event', 'generate_lead', {
  conversion_id: 'lead_abc',
  value: 50,
  currency: 'USD',
}]);

// Bad - no value or dedup ID
trustdata.push(['event', 'generate_lead']);