If an iframe is used with DTM, implement the DTM reference code in the parent and in the iframe. To prevent double Analytics server call and rule trigger, the following solution can be used.

All of the solution below is based on this code:

var isInIframe = (parent !== window)

When a page is running inside an iframe, the parent object is different from the window object. The parent can still be accessed from within an iframe. This code never causes an error even when crossing origins.

Adobe Analytics tool

It is possible to load the tool without sending an image request (s.t() call) by adding return false in the customize page code section.

Put the following code in the Adobe Analytics tool -> Customize Page Code (select After UI settings) -> Open Editor:

var isInIframe = (parent !== window)

if(isInIframe ){

    return false; //this prevents the Adobe Analytics tool to send a pageview image request

} else {

    return true; //this allows the Adobe Analytics tool to send a pageview image request

}

Rules

Next step is to edit all rules in the web property. In the condition part of the rule, select custom and put the code:

var isInIframe = (parent !== window)

if(isInIframe ){

    return false; //this prevents the rule to be fired

}else{

    return true; //this allows the rule to be fired

}

Additional resources

This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License  Twitter™ and Facebook posts are not covered under the terms of Creative Commons.

Legal Notices   |   Online Privacy Policy