TrustData tracks two types of events: page views and conversions.
Page views are tracked automatically when you initialize the SDK with sendPageView: true:
trustdata.push(['init', 'YOUR_ATTRIBUTION_ID', { sendPageView: true }]);
Each page view captures:
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', {
transaction_id: 'ORD-12345', // Required - used for deduplication
value: 149.99, // Required - conversion value
currency: 'USD', // Recommended - ISO 4217 code
}]);
Full example with products:
trustdata.push(['event', 'purchase', {
transaction_id: 'ORD-12345',
value: 149.99,
currency: 'USD',
tax: 12.50,
shipping: 5.99,
products: [
{
product_id: 'SKU123',
product_name: 'Premium Widget',
quantity: 2,
price: 49.99,
},
{
product_id: 'SKU456',
product_name: 'Widget Accessory',
quantity: 1,
price: 50.01,
},
],
}]);
For lead generation (demo requests, form submissions, signups):
trustdata.push(['event', 'generate_lead', {
value: 50, // Estimated lead value
currency: 'USD',
lead_type: 'demo_request', // Optional - categorize leads
}]);
Examples:
// Demo request
trustdata.push(['event', 'generate_lead', {
value: 100,
currency: 'USD',
lead_type: 'demo_request',
}]);
// Newsletter signup
trustdata.push(['event', 'generate_lead', {
value: 10,
currency: 'USD',
lead_type: 'newsletter',
}]);
// Contact form
trustdata.push(['event', 'generate_lead', {
value: 50,
currency: 'USD',
lead_type: 'contact_form',
}]);
TrustData automatically captures parameters from the URL to enable 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
Standard UTM parameters are captured 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 |
These are added automatically by ad platforms:
| Parameter | Platform |
|---|---|
gclid | Google Ads |
fbclid | Meta Ads |
ttclid | TikTok Ads |
msclkid | Microsoft Ads |
If the user consents, TrustData captures these click IDs and uses them to match conversions back to the original ad click.
Every event includes:
| Property | Description |
|---|---|
timestamp | Event time (ISO 8601) |
url | Current page URL |
referrer | Referring URL |
visitor_id | Persistent visitor identifier |
device | Device type, browser, OS |
consent | Consent state (4 levels) |
adblock | Whether ad blocker detected |
This section documents all parameters processed by TrustData's server. Use this reference to understand what data is captured and what you can send.
These are sent automatically by the SDK with every event:
| Parameter | Type | Description |
|---|---|---|
event_name | string | Event type (page_view, purchase, generate_lead, etc.) |
event_time | integer | Unix timestamp (seconds) |
attribution_id | string | Your TrustData attribution ID |
visitor_id | string | Persistent visitor identifier (from local storage) |
user_id | string | Authenticated user ID (if set via trustdata.push(['set', 'user_id', 'xxx'])) |
page_location | string | Full page URL |
page_referrer | string | Referrer URL |
page_title | string | Page title |
raw_user_agent | string | Browser user agent |
browser_language | string | Browser language (e.g., en-US) |
timezone | string | IANA timezone (e.g., Europe/Paris) |
timezone_offset | integer | UTC offset in minutes |
screen_resolution | string | Screen size (e.g., 1920x1080) |
viewport_resolution | string | Viewport size (e.g., 1440x900) |
lib | string | SDK identifier (web) |
lib_version | string | SDK version |
These are calculated server-side from the client data:
| Parameter | Type | Description |
|---|---|---|
session_id | string | Ephemeral session identifier |
session_number | integer | Visitor's session count (1, 2, 3...) |
first_visit | boolean | true if this is the visitor's first session |
entrances | boolean | true if this is the first page_view of the session |
| Parameter | Type | Description |
|---|---|---|
page_hostname | string | Domain (e.g., example.com) |
page_path | string | Path (e.g., /landing/page) |
| Parameter | Type | Description |
|---|---|---|
source | string | Traffic source (google, facebook, direct, etc.) |
medium | string | Traffic medium (cpc, organic, referral, etc.) |
campaign | string | Campaign name (from utm_campaign) |
content | string | Ad content (from utm_content) |
term | string | Search term (from utm_term) |
campaign_id | string | Campaign ID (from trdt_cpid) |
ad_group_id | string | Ad group ID (from trdt_agid) |
keyword_id | string | Keyword ID (from trdt_kwid) |
creative_id | string | Creative ID (from trdt_ctid) |
| Parameter | Platform | Description |
|---|---|---|
gclid | Google Ads | Google Click Identifier |
gbraid | Google Ads | App campaign click (iOS) |
wbraid | Google Ads | Web-to-app click (iOS) |
fbclid | Meta Ads | Facebook Click Identifier |
ttclid | TikTok Ads | TikTok Click Identifier |
msclkid | Microsoft Ads | Microsoft Click Identifier |
twclid | Twitter/X Ads | Twitter Click Identifier |
li_fat_id | LinkedIn Ads | LinkedIn First-Party Ad Tracking |
rdt_cid | Reddit Ads | Reddit Click Identifier |
epik | Pinterest Ads | Pinterest Click Identifier |
qclid | Quora Ads | Quora Click Identifier |
sccid | Snapchat Ads | Snapchat Click Identifier |
irclid | Impact Radius | Affiliate Click Identifier |
| Parameter | Type | Description |
|---|---|---|
browser | string | Browser name (Chrome, Safari, Firefox, etc.) |
browser_version | string | Browser version |
os | string | Operating system (Windows, macOS, iOS, Android, etc.) |
os_version | string | OS version |
device_type | string | Device category (desktop, mobile, tablet) |
| Parameter | Type | Description |
|---|---|---|
country | string | Country code (ISO 3166-1 alpha-2) |
region | string | State/region |
city | string | City name |
continent | string | Continent |
Consent state can be sent with events:
| Parameter | Type | Description |
|---|---|---|
consent_analytics | boolean | Analytics/measurement consent |
consent_advertising | boolean | Ad targeting/remarketing consent |
consent_preferences | boolean | Functional/preferences consent |
consent_sale_of_data | boolean | CCPA: allow sale of data (false = opted out) |
| Parameter | Type | Description |
|---|---|---|
adblock_detected | boolean | true if ad blocker detected |
adblock_platforms | string | Blocked platforms (e.g., google_analytics,facebook) |
For purchase and add_to_cart events:
| Parameter | Type | Description |
|---|---|---|
transaction_id | string | Unique order/transaction ID |
value | number | Total conversion value |
currency | string | ISO 4217 currency code |
tax | number | Tax amount |
shipping | number | Shipping cost |
discount_code | string | Applied discount code |
discount | number | Discount amount |
Each item in the products array can include:
| Parameter | Type | Description |
|---|---|---|
product_id | string | Product identifier |
variant_id | string | Variant identifier |
sku | string | Stock keeping unit |
product_name | string | Product name |
variant_title | string | Variant name |
brand | string | Product brand |
category | string | Product category |
price | number | Unit price |
quantity | integer | Quantity |
image_url | string | Product image URL |
url | string | Product page URL |
For better ad platform matching, you can send user data (hashed automatically):
trustdata.push(['event', 'purchase', {
transaction_id: 'ORD-12345',
value: 149.99,
currency: 'USD',
user_data: {
email: 'customer@example.com',
phone: '+1234567890',
first_name: 'John',
last_name: 'Doe',
address: {
street: '123 Main St',
city: 'New York',
region: 'NY',
postal_code: '10001',
country: 'US'
}
}
}]);
| Parameter | Type | Description |
|---|---|---|
user_data.email | string | Customer email |
user_data.phone | string | Customer phone (E.164 format) |
user_data.first_name | string | First name |
user_data.last_name | string | Last name |
user_data.address.street | string | Street address |
user_data.address.city | string | City |
user_data.address.region | string | State/region |
user_data.address.postal_code | string | Postal/ZIP code |
user_data.address.country | string | Country code (ISO 3166-1 alpha-2) |
You can send any additional parameters via the params object:
trustdata.push(['event', 'purchase', {
transaction_id: 'ORD-12345',
value: 149.99,
currency: 'USD',
params: {
payment_method: 'credit_card',
coupon_used: true,
customer_tier: 'gold'
}
}]);
Custom parameters are stored and available in the API for analysis.
For purchases, always include a unique transaction_id to prevent duplicate conversions:
trustdata.push(['event', 'purchase', {
transaction_id: 'ORD-12345', // Prevents duplicates
value: 149.99,
currency: 'USD',
}]);
Attribution depends on conversion value. Always include it:
// Good
trustdata.push(['event', 'generate_lead', {
value: 50,
currency: 'USD',
}]);
// Bad - no value for attribution
trustdata.push(['event', 'generate_lead']);