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.
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.
One template covers every job. The Command field picks the job, and the trigger has to match it.
| Command | Trigger | What it does |
|---|---|---|
| Initialize + send event (All Pages) | All Pages | Loads the SDK and sends page_view |
| Send event | Any trigger | Sends an event. It loads the SDK first if no TrustData tag has |
| Send consent decision (CMP event) | Your consent platform's event | Records a consent choice. Needed only when Decision capture is Manual |
| Initialize only | Consent Initialization or All Pages | Loads the SDK without sending 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:
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'
}
});
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:
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 capture | When to use it | Setup |
|---|---|---|
| Auto (IAB TCF) | Your consent platform supports IAB TCF | None. This is the default |
| Manual | Your consent platform has no TCF support | A 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.
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.
+ is hashed as it is.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.| Field | Default | What it does |
|---|---|---|
| Attribution ID | none | The web stream to send events to. Required |
| Command | Initialize + send event | The job this tag does |
| Decision capture | Auto (IAB TCF) | How a consent choice is recorded |
| Consent source | Google Consent Mode | Where consent values are read from |
| User ID | empty | Your authenticated user ID. Sent only with advertising consent |
| Default phone country code | empty | Country code for phone numbers in national format |
| API host | https://t.trustdata.tech | Change it only if you serve the collector from your own domain |
| Ignore domains | empty | Hostnames to drop, such as staging.example.com |
| Enable verbose SDK logging | off | Extra console output while you debug |
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.