Analytics and Tracking

iframe Tracking

Also called iFrame tracking

Measuring what visitors do inside embedded windows such as booking widgets and forms, which page tags cannot see into directly.

Quick facts: iframe Tracking

Category
Analytics and Tracking
Also called
iFrame tracking
Level
Advanced
Affects
Booking and enquiry tracking, ad platform optimisation, source attribution, cookie consent
Where to see it
Google Tag Manager preview mode, GA4 DebugView, browser developer console, booking tool analytics settings
In this article4
  1. How iframe tracking works
  2. Why it matters
  3. Common mistakes
  4. How to act on it

iframe tracking is the work of measuring what visitors do inside an iframe, a window that displays another web page within yours, such as an embedded booking widget, enquiry form, video or payment box. Your analytics tags cannot normally see inside these windows, so bookings and enquiries made there go unrecorded unless you plan for them.

How iframe tracking works

An iframe is a separate document with its own address. If it comes from another domain, browsers deliberately keep your page’s scripts out of it for security. Your Google Tag Manager container sees that the iframe loaded, but not the button clicks or form submissions inside it.

There are four main ways around this, depending on who controls the embedded page:

  • Native integrations. Many booking and form tools offer their own GA4 connection or Tag Manager option in their settings. Check this first.
  • Messages to the parent page. Some tools announce actions to the page that hosts them using a browser feature called postMessage. Calendly, for example, sends a message when a meeting is booked. A listener on your page catches the message and turns it into a dataLayer.push, which Tag Manager can treat like any other event.
  • Tags inside the iframe. If the embedded page is on your own domain, or the provider lets you add a container, you can tag it directly. The visit then needs connecting to the parent page, or GA4 counts it as a separate visitor.
  • A thank-you page. If the tool can redirect the whole browser window to a confirmation page on your site after completion, you can track that page load instead.

Why it matters

Plenty of UK service businesses take their most valuable actions through embedded third-party tools: salons and clinics with an online booking widget, restaurants with a table reservation box, consultants with a calendar embed, and many firms with a HubSpot or Typeform enquiry form. If none of these send data to GA4, your analytics shows visitors arriving and apparently doing nothing.

The cost goes beyond reporting. Google Ads and Meta cannot optimise towards bookings they never hear about, so they fall back on weaker signals such as page views. Campaigns that genuinely produce bookings look like they fail, and you may switch off the ones that work.

There is also a consent point. Embedded tools often set their own cookies. Under PECR the non-essential ones need consent just as your own do, and your cookie policy should name them.

Common mistakes

  • Assuming Tag Manager sees everything on the page, then wondering why bookings never appear.
  • Installing GA4 inside the iframe without linking the visit, which splits one person into two users, often with the embedded tool’s domain showing up as a referral source. Cross-domain tracking settings or passing the client ID are needed.
  • Relying on cookies inside a third-party iframe. Safari and Firefox block or partition third-party cookies, so tracking inside the frame loses the visitor.
  • Counting the iframe loading, or a click on it, as a conversion.
  • Listening to every message without checking which domain sent it, which lets unrelated scripts trigger false conversions.

How to act on it

List every embedded tool on the site and note what visitors do in each. Then work through the options above in order: native integration, postMessage listener, a tag in the frame, redirect to a thank-you page. Choose the simplest one that reports the completed action, not just the start.

Test with real bookings in Tag Manager’s preview mode and GA4 DebugView, and confirm that the conversion carries the original source, not the booking tool’s domain.

Embedded forms and booking widgets are among the commonest gaps I find when setting up tracking for performance marketing campaigns.

Do and do not

Do

  • Check the embedded tool's own GA4 or Tag Manager option first
  • Track the completed booking, not the widget loading
  • Check the sender's domain in any postMessage listener

Do not

  • Assume Tag Manager can see inside third-party iframes
  • Tag the iframe without linking the session to the parent page
  • Forget the embedded tool's cookies in your consent setup

Questions people ask about this

Why does my booking widget show up as a referral in GA4?

Usually because the widget is tagged separately or redirects visitors through the provider's domain, and GA4 treats the return as a new visit from that site. Adding the provider's domain to your referral exclusions, or setting up cross-domain tracking where the tool supports it, keeps the credit with the original source.

Can Google Tag Manager track a form in an iframe?

Not directly if the form is served from another domain, because the browser blocks your page's scripts from reading it. You need the form provider's own tracking option, a postMessage listener on your page, or a redirect to a thank-you page on your site. If the form is on your own domain, you can install the container inside it.

Is it better to avoid iframes altogether?

Where you have a choice, a form or booking flow built into your own pages is easier to track and often faster to load. But many good booking and scheduling tools only offer an embed, and switching tools just for tracking is rarely worth it. Most widely used tools offer at least one workable tracking route.

Related terms

Found this useful?

Share it, or ask an AI to summarise it

Back to the glossary

Knowing the term is the easy part

Applying it to your own site and budget is the work. Book a call and I will tell you what actually applies to you.