Monetate and iFrames

Monetate can use an inline frame, iFrame, within actions and within an experience—but with some caveats.

iFrame code is highlighted in a browser's developer tool, and a contextual menu appears with the 'View Frame Source' highlighted

Monetate actions work by default within iFrames if the iFrame content is on the same domain as the site on which you have implemented Monetate.

You can't select iFrame content within Action Builder. Typically, you use an iFrame to embed another webpage within the current HTML document. As a result, you can't choose a selector within an iFrame because it technically doesn't exist on the page. It exists on a separate page that gets called onto the current page. However, you can select the iFrame node itself if you want to hide the entire iFrame.

If you come across an iFrame element, you can view the source of that iFrame to determine if the Monetate tag is present or grab the URL of the iFrame to do the same.

You can grab the URL from the node's src attribute:src=""

Actions in iFrames

You can run actions on iFrames, within reason. You can edit content within the iFrame as long as the Monetate Tag and API are properly installed on the iFrame page. This is limited to iFrames within same domain and protocol, which means they are still the same domain name as your website and you have control over that page's content.

To build actions on iFrames, you need to navigate to the iFrame source page and run Action Builder on the iFrame's URL. Then, you can build an action, target, or event there.

API Analytics and iFrames

It is important to note that if you call an iFrame within a page and both the root webpage and the iFrame have the Monetate tag and API installed, then there are two track requests occurring simultaneously. These count as separate tracks.

It can be easy to miss the separate tracks because the Monetate Inspector tool only shows the track and data from the root webpage and doesn't show any information tracked in the iFrame. This data is recorded and sent through to the backend and displays in your analytics.

Custom Collect Scripts and iFrames

If your site runs a Monetate custom collect script and not the API, it doesn't allow non-parent windows (iFrames) to track. You can add tracking for iFrames with a request for custom development.