While we don't offer iframe embeds yet, people can and do stick embeds in their own iframes. In this case, pixel ping reports the iframe's URL, rather than the enclosing parent's URL, as the source.
We need to reach out of the iframe and suss out the parent's URL as best we can. Known limitations:
Thanks to same-origin policies and deployment realities, we can't reach out via window.top or window.parent. Apparently the specs say we should be able to, but browsers don't actually let us. Thus, we can only reliably reach up one iframe level, not all the way to the top.
If we use document.referrer as suggested, then any in-frame navigation breaks the referrer link to the parent page.
While we don't offer iframe embeds yet, people can and do stick embeds in their own iframes. In this case, pixel ping reports the iframe's URL, rather than the enclosing parent's URL, as the source.
We need to reach out of the iframe and suss out the parent's URL as best we can. Known limitations:
window.top
orwindow.parent
. Apparently the specs say we should be able to, but browsers don't actually let us. Thus, we can only reliably reach up one iframe level, not all the way to the top.document.referrer
as suggested, then any in-frame navigation breaks the referrer link to the parent page.