Adobe Marketing Cloud variables can be referenced from both the child and parent frames. It is necessary to define all variables in the same location the image request is fired. The following examples explain how to set s.pageName and send an image request inside and outside a frame:
// To reference Appmeasurement within an iFrame: document.getElementById('targetFrame').contentWindow.s.pageName="Page Name within iFrame"; document.getElementById('targetFrame').contentWindow.s.t(); /* or if there's only one frame */ window.frames.contentWindow.s.pageName = "Page Name within iFrame"; window.frames.contentWindow.s.t(); // To reference Appmeasurement in a parent window: parent.s.pageName = "Page Name on Hosted Window"; parent.s.t();
Adobe doesn't recommend that you implement AppMeasurement code within both the frame and the parent. That implementation effectively doubles image requests sent to data collection servers.
- Domains must match. Subdomains can differ, as long as they are on the same root domain.
- Protocols must match (both must be http:// or https://).
- If implementing code within a frame, the referrer value is set to the parent, not the actual referring URL. Manually defining s.referrer can resolve this discrepancy.
- The Debugger does not recognize image requests fired within frames.
- ClickMap does not display the heatmap over links clicked within frames. the entire frame is instead highlighted.
Related Help Articles: