Track the full checkout funnel with GA4 when using an iframe-based legacy
Checkout integration.
Merchants using the legacy Checkout integration (iframe hosted on
iglobalstores.com) can now track GA4 analytics events across the full
checkout funnel. Zonos Checkout automatically relays analytics events from the
iframe to the parent page using a lightweight relay script, so events appear in
your GA4 property as if they originated from your own site.
Native integrations don't need this guide. If <zonos-checkout> renders
directly on your site (no iframe), Zonos calls your page's window.gtag in
place — just enable Google Analytics in the Zonos dashboard under
Checkout settings → Tracking and make sure your usual GA4 base tag is
loaded on the page. The relay setup below is only required when Checkout is
hosted in an iframe on a different origin.
Looking to track Meta Ads conversions instead? See the
Facebook Pixel guide
-- it uses the same relay script and can run alongside GA4.
Because the Zonos Checkout runs inside an iframe on a different origin, it
cannot directly access your page's gtag function. The relay system solves this
with a two-step handshake (steps 1-2) followed by event forwarding (step 3):
Checkout pings the parent -- When the checkout loads inside the iframe,
it sends a message to the parent window indicating it's ready to relay
events.
Parent acknowledges -- The relay script on your page receives the ping,
detects your existing GA4 configuration, and signals back that it's ready to
receive events.
Events are forwarded -- As shoppers progress through checkout, each
analytics event is sent via postMessage to your page, where the relay
script forwards it to gtag.
All messages are validated against trusted Zonos origins (zonos.com and
iglobalstores.com) over HTTPS only.
If you don't already have GA4 installed on your site, add the standard Google
Analytics 4 tag to the <head> of the page that hosts the Checkout iframe.
Replace G-XXXXXXXXXX with your own measurement ID.
Note: If your site already has the GA4 tag installed (e.g., through Google
Tag Manager or a direct snippet), you can skip this step. The relay script
will use your existing gtag function.
You can find this snippet in your GA4 property under Admin -> Data
Streams -> select your stream -> View tag instructions -> Install
manually.
Step 2: Pass your measurement ID to Zonos Checkout
Tell Zonos Checkout which GA4 measurement ID to use by setting
window.Zonos.googleAnalyticId inside your Checkout's customHTML. The Zonos
dashboard exposes a customHTML editor under Checkout settings -- add a
<script> tag like this:
1<script>
2window.Zonos.googleAnalyticId = "G-XXXXXXXXXX";
3</script>
This value is sent to the parent during the relay handshake. If your parent
page doesn't already have gtag loaded, the relay script will inject the GA4
base tag for you using this ID.
Step 3: Add the Zonos analytics relay script
Add the following script tag to the same page, after the GA4 tag. This script
listens for analytics events from the Zonos Checkout iframe and forwards them to
your gtag.
That's it. Once both scripts are on your page, the relay script automatically
completes the handshake with the checkout iframe and forwards all checkout
funnel events to your GA4 property.
No. The relay system works independently of the createTempCart API. You only
need to add the GA4 tag and the relay script to your page.
What if I already use footerHTML for Google Analytics?
The footerHTML parameter in the
createTempCart API
injects scripts inside the checkout iframe, which is limited to tracking
page-level events within the iframe origin. The relay approach is recommended
because it sends events to your own GA4 property on your domain, giving you full
funnel visibility in a single property.
You can safely remove any GA4 scripts from footerHTML after setting up the
relay.
Does this work with GA4 debug mode in Google Analytics?
Yes. You can use zonosDebug=1 to enable relay script logs in your browser's developer console, and use the
GA4 DebugView in Google
Analytics to verify events in real time.
Are test orders tracked?
All events include an isTestMode field. When Checkout is in test mode, events
are still sent to GA4 but flagged with isTestMode: true. You can filter these
out in GA4 using custom dimensions if needed.
Google Analytics 4
Google Analytics 4 for iframe Checkout
Track the full checkout funnel with GA4 when using an iframe-based legacy Checkout integration.
Merchants using the legacy Checkout integration (iframe hosted on
iglobalstores.com) can now track GA4 analytics events across the full checkout funnel. Zonos Checkout automatically relays analytics events from the iframe to the parent page using a lightweight relay script, so events appear in your GA4 property as if they originated from your own site.How it works
Because the Zonos Checkout runs inside an iframe on a different origin, it cannot directly access your page's
gtagfunction. The relay system solves this with a two-step handshake (steps 1-2) followed by event forwarding (step 3):postMessageto your page, where the relay script forwards it togtag.All messages are validated against trusted Zonos origins (
zonos.comandiglobalstores.com) over HTTPS only.Prerequisites
G-XXXXXXXXXX). You can create one in Google Analytics.Setup
Step 1: Add the GA4 tag to your page
If you don't already have GA4 installed on your site, add the standard Google Analytics 4 tag to the
<head>of the page that hosts the Checkout iframe. ReplaceG-XXXXXXXXXXwith your own measurement ID.<!-- Google tag (gtag.js) --><scriptasyncsrc="https://www.googletagmanager.com/gtag/js?id=G-XXXXXXXXXX"></script><script>window.dataLayer = window.dataLayer || [];function gtag() {dataLayer.push(arguments);}gtag("js", new Date());gtag("config", "G-XXXXXXXXXX");</script>You can find this snippet in your GA4 property under Admin -> Data Streams -> select your stream -> View tag instructions -> Install manually.
Step 2: Pass your measurement ID to Zonos Checkout
Tell Zonos Checkout which GA4 measurement ID to use by setting
window.Zonos.googleAnalyticIdinside your Checkout'scustomHTML. The Zonos dashboard exposes acustomHTMLeditor under Checkout settings -- add a<script>tag like this:<script>window.Zonos.googleAnalyticId = "G-XXXXXXXXXX";</script>This value is sent to the parent during the relay handshake. If your parent page doesn't already have
gtagloaded, the relay script will inject the GA4 base tag for you using this ID.Step 3: Add the Zonos analytics relay script
Add the following script tag to the same page, after the GA4 tag. This script listens for analytics events from the Zonos Checkout iframe and forwards them to your
gtag.<scriptasyncsrc="https://cdn.jsdelivr.net/npm/@zonos/elements/dist/scripts/analyticsRelayOnInit.js"></script>Complete example
Here's what the full setup looks like in your page's
<head>:<head><!-- ... your existing head tags ... --><!-- Google tag (gtag.js) --><scriptasyncsrc="https://www.googletagmanager.com/gtag/js?id=G-XXXXXXXXXX"></script><script>window.dataLayer = window.dataLayer || [];function gtag() {dataLayer.push(arguments);}gtag("js", new Date());gtag("config", "G-XXXXXXXXXX");</script><!-- Zonos analytics relay for iframe checkout --><scriptasyncsrc="https://cdn.jsdelivr.net/npm/@zonos/elements/dist/scripts/analyticsRelayOnInit.js"></script></head>That's it. Once both scripts are on your page, the relay script automatically completes the handshake with the checkout iframe and forwards all checkout funnel events to your GA4 property.
GA4 events reference
Zonos Checkout emits the following events through the relay. All events include an
isTestModeflag and thecheckoutSessionId.zonos-checkout-startzonos-checkout-customer-infozonos-checkout-shipping-infoserviceLevelIdzonos-checkout-payment-infopaymentMethodzonos-checkout-payment-failzonos-checkout-successtransaction_id,currency,value,itemszonos-checkout-closepurchasetransaction_id,currency,value,itemsPurchase event metadata
The
purchaseevent follows the GA4 e-commercepurchaseevent schema:transaction_idcurrencyUSD)valueitemsitem_id,item_name,price, andquantityDebugging
To enable debug logging for the relay script, add the
zonosDebug=1query parameter to your page URL:https://www.yourstore.com/checkout?zonosDebug=1Open your browser's developer console to see detailed logs of the relay handshake and forwarded events. This is useful for verifying that:
gtag.Common questions
Do I need to modify my
createTempCartAPI call?No. The relay system works independently of the
createTempCartAPI. You only need to add the GA4 tag and the relay script to your page.What if I already use
footerHTMLfor Google Analytics?The
footerHTMLparameter in thecreateTempCartAPI injects scripts inside the checkout iframe, which is limited to tracking page-level events within the iframe origin. The relay approach is recommended because it sends events to your own GA4 property on your domain, giving you full funnel visibility in a single property.You can safely remove any GA4 scripts from
footerHTMLafter setting up the relay.Does this work with GA4 debug mode in Google Analytics?
Yes. You can use
zonosDebug=1to enable relay script logs in your browser's developer console, and use the GA4 DebugView in Google Analytics to verify events in real time.Are test orders tracked?
All events include an
isTestModefield. When Checkout is in test mode, events are still sent to GA4 but flagged withisTestMode: true. You can filter these out in GA4 using custom dimensions if needed.Was this page helpful?