Skip to content
Faisal Mahmud TusherDigital marketing, SEO & analytics
with Faisal Tusher

Marketing Analytics › Google Tag Manager

Tracking Embedded Widgets and Hosted Pages

How to measure actions inside third-party booking widgets, iframes, chat tools and hosted checkouts, where your own tags cannot see, and keep the source.
Guideadvanced11 min readUpdated

Why embedded tools break measurement

Tag Manager (GTM) 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 layer, 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

SituationWhat your container can seeWhat it cannot seeOptions that exist
A widget in a frame on your pageYour page, the frame's presence, any messages the widget sends to the pageClicks, steps and the outcome inside the frameVendor's analytics settings; documented messages to the parent page; a return or confirmation page you control
A hosted page on the vendor's domainYour pages before and after, if the person comes backEverything on the vendor's domain unless the vendor carries your tagCross-domain settings where both sides carry your tag; a return to your confirmation page; a server confirmation
A chat tool on your pageThat the chat loaded; events the vendor emits to the pageThe conversation and its outcomeVendor-documented events; outcomes recorded in your CRM with the source attached
A payment provider in checkoutYour checkout and your confirmation pageThe payment itself; buyers who do not returnUnwanted 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.

HopHow the source is keptWhere it is described
Between domains that all carry your tagCross-domain measurement: the tag adds a linker parameter so the same identifier continuesThe setup tutorial's cross-domain step
Through a provider that does not carry your tag and sends people backList the provider as an unwanted referral so the return does not overwrite the session's sourceThe same step of the setup tutorial
To a vendor domain that never sends people backPass your own reference into the link and store the visit's source against it in your own systemsGeneral practice; the vendor stores and returns the reference
Into a chat or form the vendor storesAttach the page and campaign context to the record where the vendor documents a field for itThe 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 Deduplication possible, in analytics and in the ad platforms alike.

Ad platforms raise the same problem in a sharper form, because their tracking pixels 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.

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 mode 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 byKeep the source byWatch for
Runs in a frame and can send people to an address you chooseA return to your confirmation page with the vendor's referenceThe visit continuing on your domainReloads; people who close the frame without returning
Runs in a frame and documents messages to the parent pageA listener that turns the message into your own data layer eventThe visit never leaving your pageMessages from other origins; vendor format changes
Lives on a vendor domain that carries your tagYour tag on both sides, with cross-domain settingsThe linker parameterLinks built in ways the tag cannot decorate
Lives on a vendor domain without your tagA return page, plus your system's record for those who never returnYour own reference passed to the vendorDouble counting when both routes report one outcome
Is a payment step inside your checkoutYour confirmation page, plus the order system for non-returnsUnwanted referrals for the providerThe provider's own receipt page ending the journey
Is a chat or messaging toolThe outcome recorded in your CRM, plus vendor-documented events for engagementPage and campaign context on the conversation recordCounting chats opened as leads
Offers only its own built-in analyticsThe vendor's report as a partial view, reconciled with your own recordsA reference wherever the vendor allows oneTreating the vendor's count as the record
Illustrative example — not a real result

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.

MeasureSeptember (before)November (after)
Bookings in the booking system1,1201,180
Bookings recorded by the confirmation page—1,010
Added from booking notifications—140
Unmatched—30
Share credited to direct92%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.

Frequently asked questions

Can Tag Manager on my page see clicks and form submissions inside an embedded booking widget?

No. A widget loaded in a frame from another domain is a separate page as far as the browser is concerned, and your container's triggers only hear events on your own page. What reaches your page is whatever the widget chooses to send out: some vendors document messages the widget posts to the parent page when a booking completes, which a listener can turn into a data layer push. Where the vendor documents nothing, record the outcome on a return page you control or confirm it from your own systems.

Should I put my analytics tag inside the vendor's widget if the vendor offers a field for it?

Only with care. A tag inside the widget measures the widget as its own page, often without the campaign source the visitor arrived with, and it may run under the vendor's cookie and consent handling rather than yours. It can be useful for steps inside the booking flow, but it is a weak source of the outcome and of attribution. Record the outcome on your own domain or from your own systems first, and treat any in-widget tag as a supplement whose events are named so they cannot be confused with yours.

Does cross-domain measurement fix tracking on a hosted checkout?

Only when your tag runs on both sides. Cross-domain measurement, as the setup tutorial describes, decorates links between domains that carry the same tag so the visitor keeps one identifier and one session. A provider's checkout that does not carry your tag cannot take part. For those pages the fixes are the unwanted referrals list, so the return does not overwrite the source, a return to your own confirmation page, and confirmation from your order system for buyers who never come back.

Terms used on this page

Frameworks

Where this page is used

Part of these learning paths

Sources

  1. The data layer — Google Tag Platform
  2. Google Analytics Help — Google Analytics Help
  3. Consent mode — Google Tag Platform

Related