WebmasterID logoWebmasterID
Data quality

Iframe tracking issues

An iframe is a nested browsing context with its own document, origin, and storage partition. Analytics running inside an iframe report the iframe's URL (not the parent page), see the parent as the referrer, and — under storage partitioning — cannot share cookies with the top-level site. This produces orphaned pageviews, self-referrals, and broken identity. This page explains the constraints.

Verified against primary sources

Why iframes complicate measurement

An iframe loads a separate document inside the parent. JavaScript inside it sees window.location of the iframe's own URL, and document.referrer typically shows the parent page. If the iframe is cross-origin, the same-origin policy blocks it from reading the parent's DOM or storage, so a tag inside cannot know the parent page's URL without explicit messaging.

Identity and referrer breakage

Browsers now partition storage by top-level site, so a cross-origin iframe gets its own cookie/storage jar separate from the parent. That means an analytics client id set inside the iframe does not match the parent's, fragmenting identity. The iframe's hit also records the parent as its referrer, which can surface as a self-referral when the embed and host share a domain family.

Fixes include sending the parent's URL into the iframe via postMessage so the tag reports the real page, and deciding deliberately whether the iframe should be tracked at all.

How it appears in analytics and logs

Pageviews for an embed/widget URL with the parent page as referrer usually mean a tag is firing inside an iframe, not on the visible page itself.

Diagnostic use case

Explain why an embedded widget or checkout in an iframe produces pageviews for an unfamiliar URL, or shows the host page as a referrer.

What WebmasterID can help detect

WebmasterID records events from the context that fires them, so you can tell parent-page activity from iframe-embedded activity rather than blending them.

Common mistakes

Privacy and accuracy notes

Cross-origin iframes are increasingly storage-partitioned by browsers; do not rely on shared third-party cookies. This page is educational, not legal advice.

Related pages

Sources and verification notes

Last reviewed 2026-06-24. Facts are checked against primary/official sources where available; uncertain specifics are marked “Data not yet verified” rather than guessed.