Why embedded tools break measurement
Tag Manager (GTMTag management system.) works by listening to the page it is installed on. Its triggers hear the page's own events and the pushes the site makes to the data layerA structured object on a web page that passes values to a tag manager for tags to use., which Google's documentation describes as the object that passes information from the site to the container. A third-party tool breaks that arrangement in one of three ways.
It can run in a frame. A frame from another domain is a separate document, and the browser keeps your page's scripts out of it, so no trigger on your page fires on a click or a submission inside it. It can take the person to another domain. A hosted booking page or checkout belongs to the vendor; your container only runs there if the vendor has installed it, and even then the visit may start again without its source. Or it can run as a script on your page but keep its events to itself, as many chat tools do: the conversation happens in the vendor's interface, and your page sees only what the vendor chooses to emit.
The symptoms are familiar. Outcomes are missing entirely; the troubleshooting page on a GA4 purchase event that is not tracking starts with buyers who pay on a provider's page and never return. Or outcomes arrive credited to the wrong source: the direct traffic diagnosis lists domain hops that start a new visit as one of the routes by which real campaign traffic turns into direct.
Four situations and what each allows
| Situation | What your container can see | What it cannot see | Options that exist |
|---|---|---|---|
| A widget in a frame on your page | Your page, the frame's presence, any messages the widget sends to the page | Clicks, steps and the outcome inside the frame | Vendor's analytics settings; documented messages to the parent page; a return or confirmation page you control |
| A hosted page on the vendor's domain | Your pages before and after, if the person comes back | Everything on the vendor's domain unless the vendor carries your tag | Cross-domain settings where both sides carry your tag; a return to your confirmation page; a server confirmation |
| A chat tool on your page | That the chat loaded; events the vendor emits to the page | The conversation and its outcome | Vendor-documented events; outcomes recorded in your CRM with the source attached |
| A payment provider in checkout | Your checkout and your confirmation page | The payment itself; buyers who do not return | Unwanted referrals; the provider's automatic return; confirming the order from your order system |
Two points apply to every row. Use only what the vendor documents: a message format, a return address setting, a notification to your server. Behaviour you observed once and that the vendor does not document can change without notice. And decide per tool, in the measurement plan, which signal is the record of the outcome, so that two partial signals are not added together.
Recording the outcome where you control the code
The most dependable record of an outcome is one your own code makes, on your own domain, after the outcome is true. For an embedded or hosted tool that usually means one of two things.
A return to your confirmation page. Most booking, form and payment tools let you set where the person goes after completing: a thank-you or confirmation address on your site. Configure it, pass a reference the vendor returns (a booking or order reference), and have that page push the outcome to the data layer once, with the reference as the identifier. The page is yours, so the push follows your contract, your consent handling and your container. Guard it against reloads, which the data layer guide treats under pushing when the thing is true rather than when it is tried.
A documented message to the parent page. Some widgets in frames post a message to the page that embeds them when a step completes. Where the vendor documents the message and its contents, a small listener on your page can check that the message comes from the vendor's domain, read the fields it needs, and push a data layer event in your own vocabulary. Your tags then fire on your event, not on the vendor's, so swapping vendors later means changing the listener, not every tag.
Whichever signal you use, name the event as your tracking plan does for outcomes everywhere else, so a booking
made in a widget and a booking made on your own form are the same event with a different method or
provider parameter.
Keeping the source across the hop
An outcome without its source answers half the question. The source is lost when the person moves to another domain and the visit starts again, or when the outcome is recorded somewhere that never knew where the person came from.
| Hop | How the source is kept | Where it is described |
|---|---|---|
| Between domains that all carry your tag | Cross-domain measurement: the tag adds a linker parameter so the same identifier continues | The setup tutorial's cross-domain step |
| Through a provider that does not carry your tag and sends people back | List the provider as an unwanted referral so the return does not overwrite the session's source | The same step of the setup tutorial |
| To a vendor domain that never sends people back | Pass your own reference into the link and store the visit's source against it in your own systems | General practice; the vendor stores and returns the reference |
| Into a chat or form the vendor stores | Attach the page and campaign context to the record where the vendor documents a field for it | The vendor's documentation |
The third row is the one that needs designing. When the person starts a booking on your site, your own code can record the landing source of the visit (campaign tags, referrer) against a reference that it also passes to the vendor, as a field the vendor documents or a parameter on the booking link. When the outcome later comes back from the vendor, by return or by notification, it carries that reference, and the source can be joined back in your own systems. The cross-domain glossary entry explains why the identifier and the source travel together when both sides carry the tag; this pattern does the same job by hand when one side does not. The academy exercise on recording bookings made inside a cookery school's booking widget practises this pattern for bookings in a third-party widget and voucher sales on a hosted checkout, each kept with its source.
Server confirmation when the browser cannot see
Some outcomes will never reach a page you control. A buyer closes the tab once the bank approves; a guest books inside a widget and never clicks the return link; a chat ends with an appointment the browser knows nothing about. For these, the outcome has to come from a system rather than a browser: a notification the vendor sends to your server when a booking or payment completes, where the vendor documents one, or your own order or booking system, which records every outcome whatever the browser did.
The purchase troubleshooting page applies this to orders that never return from payment: turn on the provider's automatic return where it is offered, and for orders that still do not return, send the purchase from the order system with the same transaction identifier. The shared identifier is the whole safeguard. When the same outcome can arrive by two routes, one reference on both is what makes DeduplicationRemoving double counts when one conversion is reported by more than one source. possible, in analytics and in the ad platforms alike.
Ad platforms raise the same problem in a sharper form, because their tracking pixelsAn ad platform's browser code that reports page views and events on a site back to the platform. need a browser that will never see the outcome. Server routes to the platforms, which the server-side tagging guide introduces, send the outcome from a system instead, and each platform's own pages describe the identifiers it needs for deduplication. A server confirmation is only as good as the source attached to it, so it depends on the reference pattern in the previous section.
Consent inside third-party tools
A visitor's consent choice applies to the whole site experience, including the parts other companies run. An embedded widget or chat tool may set its own cookies and load its own tags, and a vendor's analytics inside a booking frame is still measurement of your visitor.
Google's consent documentation and the consent mode guide describe how tags read a consent modeA Google tag feature that adjusts what tags collect according to the visitor's consent choices. state, and that the consent settings on non-Google tags in the container let you require specific consent types before a tag fires, which is how a chat widget deployed through the container respects the same choice without a separate blocking trigger. Apply that to every tag that loads a third-party tool with tracking in it. Where the vendor documents a way to pass the visitor's consent state into the widget, or to load it without its own measurement, use it. Where neither exists, the choice is between loading the tool only after consent and accepting that it measures visitors who declined, which is a decision for whoever owns privacy, not a technical default.
Server confirmations need the same care, because a server does not see the banner. Record the visitor's consent state with the reference when the journey starts, and have the server send onward only what that state allows. The privacy and consent guide covers how the policy is set; this guide gives no legal advice.
Choosing an approach (decision table)
| If the tool… | Record the outcome by | Keep the source by | Watch for |
|---|---|---|---|
| Runs in a frame and can send people to an address you choose | A return to your confirmation page with the vendor's reference | The visit continuing on your domain | Reloads; people who close the frame without returning |
| Runs in a frame and documents messages to the parent page | A listener that turns the message into your own data layer event | The visit never leaving your page | Messages from other origins; vendor format changes |
| Lives on a vendor domain that carries your tag | Your tag on both sides, with cross-domain settings | The linker parameter | Links built in ways the tag cannot decorate |
| Lives on a vendor domain without your tag | A return page, plus your system's record for those who never return | Your own reference passed to the vendor | Double counting when both routes report one outcome |
| Is a payment step inside your checkout | Your confirmation page, plus the order system for non-returns | Unwanted referrals for the provider | The provider's own receipt page ending the journey |
| Is a chat or messaging tool | The outcome recorded in your CRM, plus vendor-documented events for engagement | Page and campaign context on the conversation record | Counting chats opened as leads |
| Offers only its own built-in analytics | The vendor's report as a partial view, reconciled with your own records | A reference wherever the vendor allows one | Treating the vendor's count as the record |
Fernwhistle Escape Rooms moves bookings out of the frame
Fernwhistle Escape Rooms, an invented operator of three escape-room venues, takes every booking through an embedded booking widget. The vendor's settings had a field for an analytics measurement ID, so bookings were recorded inside the frame, as their own sessions without the campaign the visitor had arrived with. In September GA4 credited 1,032 of 1,120 bookings, 92%, to direct.
The fix had three parts. The widget's completion setting was pointed at a confirmation page on Fernwhistle's
own domain, passing the booking reference, and that page pushed a purchase event once with the reference as
transaction_id. The vendor's booking notifications to Fernwhistle's booking system were used to find
bookings whose guests never reached the confirmation page, and those were sent from the booking system with
the same reference. And the measurement ID was removed from the widget, so the frame no longer created
sessions of its own.
| Measure | September (before) | November (after) |
|---|---|---|
| Bookings in the booking system | 1,120 | 1,180 |
| Bookings recorded by the confirmation page | — | 1,010 |
| Added from booking notifications | — | 140 |
| Unmatched | — | 30 |
| Share credited to direct | 92% | 9% |
With bookings recorded on their own domain, November's split showed organic search at 37%, paid search 28%, paid social 15%, email 8%, direct 9% and referrals 3%. Paid social, which had looked like it produced almost nothing, was the channel whose budget the team had been about to cut.
Common mistakes
- Trusting the vendor's in-frame tag as the record. It measures the widget as its own visit, usually without the source, and the outcome lands on direct.
- Listening to any message the frame sends. A listener that does not check the sender's domain will accept messages from anything on the page.
- Adding cross-domain settings for a domain that does not carry your tag. The linker has nothing to read on the other side.
- Forgetting unwanted referrals. The return from the payment provider becomes the source of the sale.
- Two routes without one reference. The return page and the server confirmation both report the booking, and it counts twice.
- Counting chat opens as leads. Engagement with the tool is not the outcome; the appointment or the sale is.
- Loading tracking-heavy widgets before consent. The visitor's choice on your banner applies inside the vendor's frame too.
- Relying on undocumented behaviour. A message or field the vendor does not document can change at the next release without notice.
For hotels, venues and restaurants, the hospitality guide explains why the booking or reservation system is the reliable record and platform reports a partial view. The Tag Manager hub lists the rest of this section.
