TrustData tracks two types of events: page views and conversions.
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:
Alongside page_view, the SDK emits these events automatically (no code required):
| Event | When it fires |
|---|---|
page_leave | When the visitor navigates away or closes the tab |
user_engagement | Once the page has been visible for the engagement timer (10 seconds by default) |
identity_link | When linkIdentity() links a pre-consent fingerprint to the new visitor ID after a consent upgrade |
consent_decision | When your code calls consent() with { interaction: true }, after a real choice in your consent banner |
rage_click | When a visitor clicks three or more times within one second and 30 pixels. Carries a selector and a click_count |
dead_click | When 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.
For SPAs (React, Vue, etc.), track page views on route changes:
// After route change
trustdata.push(['event', 'page_view']);
Conversions are the events that matter for attribution. TrustData supports two primary conversion types:
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,
},
],
}]);
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',
}]);
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.
The SDK sends the page URL. The event server reads the URL parameters from it and uses them for attribution.
Add these to your ad URLs for campaign tracking:
| Parameter | Purpose | Example |
|---|---|---|
trdt_cpid | Campaign ID | ?trdt_cpid={campaignid} |
trdt_agid | Ad Group ID | &trdt_agid={adgroupid} |
trdt_kwid | Keyword ID | &trdt_kwid={targetid} |
trdt_ctid | Creative/Ad ID | &trdt_ctid={creative} |
Example URL:
https://example.com/landing?trdt_cpid=123&trdt_agid=456&trdt_ctid=789
TrustData captures standard UTM parameters automatically:
| Parameter | Purpose |
|---|---|
utm_source | Traffic source (google, facebook, newsletter) |
utm_medium | Marketing medium (cpc, email, social) |
utm_campaign | Campaign name |
utm_term | Paid search keyword |
utm_content | Ad variation or link identifier |
Ad platforms add these automatically:
| Parameter | Platform |
|---|---|
gclid, gbraid, wbraid | Google Ads |
dclid | Google Display & Video 360 / Campaign Manager 360 |
fbclid | Meta Ads |
ttclid | TikTok Ads |
msclkid | Microsoft Ads |
li_fat_id | LinkedIn Ads |
twclid | X (Twitter) Ads |
rdt_cid | Reddit Ads |
epik | Pinterest Ads |
If the visitor consents, TrustData captures these click IDs and uses them to match conversions to the original ad click.
Every event includes:
| Field | Description |
|---|---|
event_time | Event time (Unix seconds) |
page_location | Current page URL |
page_referrer | Referring URL |
visitor_id | Persistent visitor identifier (omitted when analytics consent is not granted) |
raw_user_agent | User agent string, parsed server-side into browser, OS, and device |
consent | Consent state (4 levels) |
adblock_detected / adblock_platforms_blocked | Whether an ad blocker is active, and which platforms it blocks as a comma-separated list |
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.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',
}]);
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']);