TrustData
Tracking SDK

Google Tag Manager

Install TrustData through the TrustData Web Tag template for Google Tag Manager.

The TrustData Web Tag loads the SDK from a Google Tag Manager web container. Use it instead of the snippet when your site already runs Google Tag Manager. The tag reads Google Consent Mode and captures IAB TCF consent choices with no extra setup.

Install the template

  1. In Google Tag Manager, open Templates.
  2. Under Tag Templates, click Search Gallery.
  3. Search for TrustData Web Tag and click Add to workspace.

Create the tag

  1. In TrustData, open your property's Attribution IDs page.
  2. Copy the Attribution ID of the web stream.
  3. In Google Tag Manager, create a tag of type TrustData Web Tag.
  4. Paste the Attribution ID.
  5. Set Command to Initialize + send event (All Pages).
  6. Add the All Pages trigger and save.
Use the Attribution ID, not the property ID. Both are UUIDs, and events sent with a property ID are not attributed.

Most sites need only this tag. It loads the SDK and sends a page_view on every page. Test it in Preview before you publish the container.

Commands

One template covers every job. The Command field picks the job, and the trigger has to match it.

CommandTriggerWhat it does
Initialize + send event (All Pages)All PagesLoads the SDK and sends page_view
Send eventAny triggerSends an event. It loads the SDK first if no TrustData tag has
Send consent decision (CMP event)Your consent platform's eventRecords a consent choice. Needed only when Decision capture is Manual
Initialize onlyConsent Initialization or All PagesLoads the SDK without sending an event

Send an event

Create a second tag with the command Send event, then pick an event name such as purchase or generate_lead. Choose Custom… to send your own name.

Add parameters two ways, and combine them freely:

  • Event parameters: a table of names and values.
  • Event parameters from a variable: a variable that returns an object, such as a Data Layer Variable for ecommerce.

When both set the same key, the table value is sent.

// A Data Layer Variable pointing at this object fills the event in one field.
dataLayer.push({
  event: 'purchase',
  ecommerce: {
    transaction_id: 'T-4821',
    value: 149.9,
    currency: 'EUR'
  }
});

Track funnel steps

Use the standard event names for standard moments: view_item, add_to_cart, begin_checkout, add_payment_info, purchase and generate_lead. TrustData places these in a funnel with no setup, counts them in sessions, and forwards the ones ad platforms support.

A booking flow or a configurator has steps with no standard name. Send those as funnel_step and fill in two fields:

  • Step index: the position of the step, starting at 1.
  • Step name: an ID such as passenger_details. Funnels match on it, so keep it stable when the page changes.

A funnel_step tag without both fields fails and sends nothing. Add value and currency as event parameters to record the basket at that step.

The tag reads Google Consent Mode: analytics_storage, ad_storage, functionality_storage and ad_user_data. Without analytics consent, the SDK stores nothing on the device and sends no visitor ID. TrustData still measures the visit, which is what keeps your traffic numbers whole.

Decision capture controls how a real choice is recorded, which is what the consent rate counts:

Decision captureWhen to use itSetup
Auto (IAB TCF)Your consent platform supports IAB TCFNone. This is the default
ManualYour consent platform has no TCF supportA second tag, below

For Manual capture, create a tag with the command Send consent decision (CMP event) and fire it on the event your consent platform pushes when a visitor accepts, rejects or saves a choice. Fire it on that event, never on page load: a page load is not a decision.

If your consent platform does not set Consent Mode at all, set Consent source to Manual (CMP variables) and map each consent type to a variable that returns granted or denied.

Personal data

Pass an email or a phone number in a user_data parameter. The tag hashes both with SHA-256 in the browser, so a raw value never leaves the page. A value that is already a SHA-256 hash is sent unchanged.

  • Emails are trimmed and lowercased before hashing.
  • A phone number that starts with + is hashed as it is.
  • A phone number in national format, such as 06 01 02 03 04, needs Default phone country code under Identity. Without it, the tag drops the phone rather than hash the wrong number.
  • If hashing fails, the tag drops that field. It never sends an unhashed value.

Settings

FieldDefaultWhat it does
Attribution IDnoneThe web stream to send events to. Required
CommandInitialize + send eventThe job this tag does
Decision captureAuto (IAB TCF)How a consent choice is recorded
Consent sourceGoogle Consent ModeWhere consent values are read from
User IDemptyYour authenticated user ID. Sent only with advertising consent
Default phone country codeemptyCountry code for phone numbers in national format
API hosthttps://t.trustdata.techChange it only if you serve the collector from your own domain
Ignore domainsemptyHostnames to drop, such as staging.example.com
Enable verbose SDK loggingoffExtra console output while you debug

Troubleshooting

The tag shows Failed in Tag Assistant. The browser did not load t.js. An ad blocker or a Content Security Policy usually blocks it. Add https://t.trustdata.tech to script-src and connect-src in your Content Security Policy.

The tag succeeds but no events arrive in TrustData. Check that the Attribution ID belongs to the web stream of the property you are looking at.

Preview shows "Phone dropped". The phone number is in national format. Set Default phone country code.

A funnel_step tag fails. Set Step index to 1 or more and fill in Step name.

The consent rate stays at zero. Your consent platform has no TCF support, so set Decision capture to Manual and add the consent decision tag above.