Track in an iFrame

An iframe (or inline frame) is an HTML document embedded inside another HTML document on a website. The iframe element is often used to insert content from another source, such as a video or social media button, into a page.

To capture interactions within an iframe, Heap must be installed on the iframe source page with the secureCookie flag enabled. To learn more, see Heap and SameSite Cookies and our secureCookie developer documentation.

If you are looking to install Heap on an iframe on your site, and you don't have access to the iframe source page, then you can't install Heap on that iframe. Some embedded widgets, such as Youtube, Vimeo, and Wistia, exist in iframes and provide an API to track interactions within the widget. For steps to set this up, see Tracking Video Plays in Heap.


To use Visual labeling with the iframe, you will need to enter the iframe source URL into the Event Visualizer.

If your use case is to install Heap on an AMP or FBIA page, see the code snippets provided in Tracking AMP or FBIA Pages.