TrustData
Tracking SDK

Events reference

Track page views and conversions with TrustData.

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

Page views

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:

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

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', {
  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,
    },
  ],
}]);

Generate lead

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',
}]);

URL parameters

TrustData automatically captures parameters from the URL to enable 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

Standard UTM parameters are captured 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

These are added automatically by ad platforms:

ParameterPlatform
gclidGoogle Ads
fbclidMeta Ads
ttclidTikTok Ads
msclkidMicrosoft Ads

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

Automatically captured data

Every event includes:

PropertyDescription
timestampEvent time (ISO 8601)
urlCurrent page URL
referrerReferring URL
visitor_idPersistent visitor identifier
deviceDevice type, browser, OS
consentConsent state (4 levels)
adblockWhether ad blocker detected

Event parameters reference

This section documents all parameters processed by TrustData's server. Use this reference to understand what data is captured and what you can send.

Client-sent parameters

These are sent automatically by the SDK with every event:

ParameterTypeDescription
event_namestringEvent type (page_view, purchase, generate_lead, etc.)
event_timeintegerUnix timestamp (seconds)
attribution_idstringYour TrustData attribution ID
visitor_idstringPersistent visitor identifier (from local storage)
user_idstringAuthenticated user ID (if set via trustdata.push(['set', 'user_id', 'xxx']))
page_locationstringFull page URL
page_referrerstringReferrer URL
page_titlestringPage title
raw_user_agentstringBrowser user agent
browser_languagestringBrowser language (e.g., en-US)
timezonestringIANA timezone (e.g., Europe/Paris)
timezone_offsetintegerUTC offset in minutes
screen_resolutionstringScreen size (e.g., 1920x1080)
viewport_resolutionstringViewport size (e.g., 1440x900)
libstringSDK identifier (web)
lib_versionstringSDK version

Server-enriched parameters

These are calculated server-side from the client data:

Session data

ParameterTypeDescription
session_idstringEphemeral session identifier
session_numberintegerVisitor's session count (1, 2, 3...)
first_visitbooleantrue if this is the visitor's first session
entrancesbooleantrue if this is the first page_view of the session

Page data (parsed from URL)

ParameterTypeDescription
page_hostnamestringDomain (e.g., example.com)
page_pathstringPath (e.g., /landing/page)

Attribution (extracted from URL)

ParameterTypeDescription
sourcestringTraffic source (google, facebook, direct, etc.)
mediumstringTraffic medium (cpc, organic, referral, etc.)
campaignstringCampaign name (from utm_campaign)
contentstringAd content (from utm_content)
termstringSearch term (from utm_term)
campaign_idstringCampaign ID (from trdt_cpid)
ad_group_idstringAd group ID (from trdt_agid)
keyword_idstringKeyword ID (from trdt_kwid)
creative_idstringCreative ID (from trdt_ctid)

Click IDs (extracted from URL)

ParameterPlatformDescription
gclidGoogle AdsGoogle Click Identifier
gbraidGoogle AdsApp campaign click (iOS)
wbraidGoogle AdsWeb-to-app click (iOS)
fbclidMeta AdsFacebook Click Identifier
ttclidTikTok AdsTikTok Click Identifier
msclkidMicrosoft AdsMicrosoft Click Identifier
twclidTwitter/X AdsTwitter Click Identifier
li_fat_idLinkedIn AdsLinkedIn First-Party Ad Tracking
rdt_cidReddit AdsReddit Click Identifier
epikPinterest AdsPinterest Click Identifier
qclidQuora AdsQuora Click Identifier
sccidSnapchat AdsSnapchat Click Identifier
irclidImpact RadiusAffiliate Click Identifier

Device data (parsed from user agent)

ParameterTypeDescription
browserstringBrowser name (Chrome, Safari, Firefox, etc.)
browser_versionstringBrowser version
osstringOperating system (Windows, macOS, iOS, Android, etc.)
os_versionstringOS version
device_typestringDevice category (desktop, mobile, tablet)

Geo data (from IP)

ParameterTypeDescription
countrystringCountry code (ISO 3166-1 alpha-2)
regionstringState/region
citystringCity name
continentstringContinent

Consent state can be sent with events:

ParameterTypeDescription
consent_analyticsbooleanAnalytics/measurement consent
consent_advertisingbooleanAd targeting/remarketing consent
consent_preferencesbooleanFunctional/preferences consent
consent_sale_of_databooleanCCPA: allow sale of data (false = opted out)

Adblock detection

ParameterTypeDescription
adblock_detectedbooleantrue if ad blocker detected
adblock_platformsstringBlocked platforms (e.g., google_analytics,facebook)

E-commerce parameters

For purchase and add_to_cart events:

ParameterTypeDescription
transaction_idstringUnique order/transaction ID
valuenumberTotal conversion value
currencystringISO 4217 currency code
taxnumberTax amount
shippingnumberShipping cost
discount_codestringApplied discount code
discountnumberDiscount amount

Product array

Each item in the products array can include:

ParameterTypeDescription
product_idstringProduct identifier
variant_idstringVariant identifier
skustringStock keeping unit
product_namestringProduct name
variant_titlestringVariant name
brandstringProduct brand
categorystringProduct category
pricenumberUnit price
quantityintegerQuantity
image_urlstringProduct image URL
urlstringProduct page URL

Enhanced conversion data

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'
    }
  }
}]);
ParameterTypeDescription
user_data.emailstringCustomer email
user_data.phonestringCustomer phone (E.164 format)
user_data.first_namestringFirst name
user_data.last_namestringLast name
user_data.address.streetstringStreet address
user_data.address.citystringCity
user_data.address.regionstringState/region
user_data.address.postal_codestringPostal/ZIP code
user_data.address.countrystringCountry code (ISO 3166-1 alpha-2)

Custom parameters

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.

Best practices

1. Always include transaction ID

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',
}]);

2. Always include value

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']);