DTM via IFrame and not parent page due to Salesforce constraints



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.


Zach Benchley

Accepted Solutions (1)

Accepted Solutions (1)




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.

Answers (0)