Skip to content
FunnelGuard

Fix guide by FunnelsGuard

Booking event missing in GA4 because of a cross-origin iframe

TRK-066High impactPartlyBy FunnelGuardPublished Updated
On this page

What this issue is

An iframe is a page embedded inside another page. A booking widget (a calendar, scheduler or appointment tool) is often loaded this way from the provider's domain, for example calendly.com or cal.com, while your site sits on yourdomain.com.

Browsers apply the same-origin policy. Code on your page cannot read the content of an iframe from a different origin. That means Google Tag Manager click triggers, form triggers and scroll triggers on your page never see what happens inside the widget. The booking is made, but GA4 hears nothing.

The one thing a cross-origin iframe can do is send messages out with window.postMessage. If you do not listen for those messages, the booking stays invisible.

Why it costs you leads or sales

A booking is often your real conversion. If GA4 never records it, your reports show visits but no bookings. Google Ads and Meta cannot learn which clicks produce appointments, so automated bidding optimises on weaker signals. Channels that actually drive bookings look like they fail, and budget moves the wrong way.

Where the booking signal gets lost
  1. Visitor opens booking pagepage_view fires normally
  2. Picks a slot in the iframeHappens on the provider's domain
  3. Parent page listensNo click, form or postMessage trigger exists
  4. GA4 booking eventNever sent
  5. Ads conversion importNothing to import

The widget finishes the booking, but the parent page never receives an event, so nothing reaches GA4 or ad platforms.

Bookings made vs bookings reportedExample numbers
Bookings made vs bookings reported (example)Bookings made: 40 bookings; Bookings in GA4: 4 bookings01531404Bookings madeBookings in GA4bookings

Example: 40 bookings were made in a month, but only the few that reached a thank-you page on your site were recorded in GA4.

How to check if your site has it

Check whether the booking is visible to GA4
  1. Confirm the widget is an iframe

    Open your booking page, right-click the widget and choose Inspect. Look for an <iframe> whose src starts with a different domain than your site.

  2. Open GA4 DebugView

    In GA4 go to Admin > DebugView. Turn on Tag Assistant preview for your site in Google Tag Manager, or use the GA debug extension.

  3. Make a test booking

    Complete a booking yourself, using a test name and your own email. Cancel it afterwards.

  4. Look for a booking event

    If DebugView shows page_view and scroll but no booking or generate_lead event at the moment you confirm, the iframe is not being tracked.

  5. See what the widget sends

    In the browser console, run window.addEventListener('message', e => console.log(e.origin, e.data)); then book again. If messages appear, you can use them. If nothing appears, use the provider's native tracking or a redirect.

Paste in the console to see what the iframe sendsjavascript
window.addEventListener('message', function (e) {
  console.log('origin:', e.origin, 'data:', e.data);
});

How to fix it

There are three routes. Pick the first one your provider supports. Always check the origin of a message before you trust it.

Ways to capture a booking from an iframe
MethodWorks whenEffort
postMessage listenerThe widget posts a message on bookingMedium
Provider's native GA4 / pixel optionThe provider offers it in its settingsLow
Redirect to your thank-you pageThe provider can redirect after bookingLow
Listen for the widget's message and send a GA4 event
  1. Add a listener tag

    Create a Custom HTML tag with the listener code below, fired on All Pages (or only on the booking page). Edit the origin and the event check to match your provider's message.

  2. Create a Custom Event trigger

    Triggers > New > Custom Event, event name booking_complete.

  3. Create the GA4 event tag

    New tag > Google Analytics: GA4 Event, event name generate_lead (or your booking event name), trigger set to the Custom Event above.

  4. Preview and publish

    Use Preview, make a test booking, check the tag fires once, then publish.

postMessage listener that pushes a dataLayer event (example for Calendly)javascript
<script>
window.dataLayer = window.dataLayer || [];
window.addEventListener('message', function (e) {
  if (e.origin !== 'https://calendly.com') return;
  if (e.data && e.data.event === 'calendly.event_scheduled') {
    window.dataLayer.push({ event: 'booking_complete', booking_provider: 'calendly' });
  }
});
</script>
If there is no usable message
  1. Look for native tracking

    Check the provider's integrations or settings for Google Analytics, Google Tag Manager or pixel fields, and enter your IDs there.

  2. Redirect after booking

    Set the provider's confirmation redirect to a thank-you page on your own domain, then fire the GA4 event on that page. Make sure the redirect keeps UTM parameters if you rely on them.

  3. Pass UTMs into the widget

    If the booking tool supports it, pass utm_source, utm_medium and utm_campaign into the embed so the lead source is stored with the booking.

A tag that never fires

The booking completes inside the iframe, but no tag on your page is triggered.

How to confirm it's fixed

Confirmation checklist
  • GTM Preview shows booking_complete after a test booking
  • GA4 DebugView shows your booking event once, not twice
  • Event parameters such as booking_provider are filled in
  • The event appears in GA4 Reports > Realtime within minutes
  • The event is marked as a key event if it is a conversion
  • Google Ads and Meta see the conversion after import or tag firing
  • A message from an unexpected origin does not trigger the event

How to prevent it happening again

Providers change their embed code and message names. Tag your booking event in a named GTM container with a note saying which provider message it depends on. Re-test after any change to the booking tool, the page or the theme. Add a booking test to your launch checklist for every new landing page that uses an embed.

How FunnelGuard handles this

FunnelGuard detects this issue only partly. A robot visitor runs your booking journey on a schedule and captures the tracking hits sent to GA4 and ad platforms. If the booking event never reaches GA4 after the journey, you will see that the hit is missing.

What it does not do: it does not inspect the postMessage listener on your page, so it cannot tell you whether your listener is wrong, looks at the wrong origin or listens for the wrong message name. It only sees the result, which is a hit or no hit.

To cover the rest by hand, use the console snippet above to log messages from the iframe, check the origin and event name in your GTM Custom HTML tag, and run a GTM Preview and GA4 DebugView test after each change. FunnelGuard never enters real card details and stops before payment unless test mode is set up, so for paid bookings set up the provider's test mode first. You can start with the Free plan (1 site, 2 journeys, daily checks, no card) or a 3-day free trial of any paid plan.

Questions people ask

Why is my GA4 booking event not firing when the calendar is embedded?

The calendar most likely sits in an iframe from another domain. Your page's tags cannot see inside it because of the browser's same-origin policy, so no click or form trigger runs. You need to listen for the widget's postMessage, use its native tracking option, or redirect to a thank-you page.

Can Google Tag Manager track clicks inside a cross-origin iframe?

No. GTM click and form triggers only work on elements of your own page. For an iframe from another domain, you can only react to messages it sends with postMessage, or track a page on your site that the visitor reaches afterwards.

How do I track a Calendly booking in GA4?

Add a script that listens for window messages from https://calendly.com and checks for the calendly.event_scheduled event. Push a custom event to the dataLayer, then trigger a GA4 event tag from it in Google Tag Manager. Test with Preview and DebugView.

What is postMessage and why does it matter for tracking?

postMessage is a browser method that lets pages from different domains send messages to each other safely. A booking iframe can use it to tell your page that a booking was made. Without a listener on your page, that message is ignored.

Is it safe to listen for postMessage events on my site?

Yes, if you check e.origin against the provider's exact domain before acting. Without that check, any other site could send a fake message and trigger your conversion event. Never use a wildcard check.

What if my booking tool does not send any message?

Check its settings for native Google Analytics or GTM fields. If there are none, set a redirect after booking to a thank-you page on your domain and fire the GA4 event there. This also helps ad platforms see the conversion.

Can FunnelGuard tell me if my iframe booking is tracked?

Partly. It runs the booking journey and captures the hits sent to GA4 and ad platforms, so it shows if the booking event is missing. It does not inspect your postMessage listener, so you check that code by hand.

Does FunnelGuard catch this?

Partly

FunnelGuard checks part of this.

How: hit capture; postMessage listener not inspected.

Stop finding out from your customers

FunnelGuard runs your real forms and checkouts on a schedule, checks the tracking and the leads behind them, and alerts you once, with a screenshot. Try any paid plan free for 3 days.