DTM via IFrame and not parent page due to Salesforce constraints | Community
Skip to main content
zachb84709270
Level 2
October 24, 2018
Solved

DTM via IFrame and not parent page due to Salesforce constraints

  • October 24, 2018
  • 1 reply
  • 1547 views

We currently have implemented a new website flow using Salesforce Communites and Lightning. The problem with Salesforce is they only allow you to inject the DTM header via an Iframe. They do not allow for the DTM header to be loaded directly on the main html page itself due to Content Security concerns. So we have created an iframe element with the src as the DTM header.

This iframe executes our DTM rules on each page however I have no access to any of the elements on the parent page in which the iframe is hosted. Therefore I have no way to grab the buttons to generate click event, etc. In the Development tools via chrome I can grab these elements via parent.document.getElementById but from DTM it does not seem that I am able to grab these and that the parent object is not defined.

Is there a way to grab the parent page elements from our iframe implementation of DTM? Is this even possible without the DTM header being on both the main page and the iframe?

Any help on this would be great.

Thanks,

Zach Benchley

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Stewart_Schilling

You are pretty much stuck unless you can get DTM embedded on the page that you want to measure.

There are ways to message between an iframe and its parent, but you'd need to have code on the parent to make it happen.

1 reply

Stewart_Schilling
Community Advisor
Stewart_SchillingCommunity AdvisorAccepted solution
Community Advisor
November 7, 2018

You are pretty much stuck unless you can get DTM embedded on the page that you want to measure.

There are ways to message between an iframe and its parent, but you'd need to have code on the parent to make it happen.