Expand my Community achievements bar.

SOLVED

Suppressing Page view from iframe

Avatar

Level 4

Hi,

One of our clients is showing iframe of other contents of the site if users hover over certain sections. As a result of this, the iframe is causing sencondary page load calls on top of the primary call for the page on which the iframe is hosted.

I want to suppress this call. We are using DTM. Any ideas how this can be done?

Sanmeet

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

we have the same setup, here's our solution (for the DTM property in the iFrame)

1) create a data element "in iFrame" which returns "yes" or "no". check by Javascript if the page is loaded in an iFrame. possible code see here: https://tommcfarlin.com/check-if-a-page-is-in-an-iframe/

2) in your page load rule add a new condition like "in iFrame = no"

this setup should stop tracking the pageload within the iFrame.

View solution in original post

1 Reply

Avatar

Correct answer by
Community Advisor

we have the same setup, here's our solution (for the DTM property in the iFrame)

1) create a data element "in iFrame" which returns "yes" or "no". check by Javascript if the page is loaded in an iFrame. possible code see here: https://tommcfarlin.com/check-if-a-page-is-in-an-iframe/

2) in your page load rule add a new condition like "in iFrame = no"

this setup should stop tracking the pageload within the iFrame.