Access the datalayer from the Parent page level to Iframe level | Community
Skip to main content
Level 2
Sep 3, 2018 7:04 AM UTC
Solved

Access the datalayer from the Parent page level to Iframe level

Hi,

Actually I have a data layer set in the parent page, from which I have created the data elements in the DTM webproperty. Also I am using those data elements in the Direct call Tag which is currently getting invoked from the Iframe page. The Iframe page was not able to access the data layer values as it was defined in the parent page.

Can anyone suggest a way to access the dataelements/ datalayer from the Parent page level to Iframe level?

Thanks in Advance!

Sundhara M.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Gigazelle
GigazelleAccepted solution
Employee
Sep 14, 2018 6:30 PM UTC

If you can access them via the browser console, you can access them in DTM. Try accessing the data layer from the console using some suggestions off of StackOverflow:

How to access parent Iframe from JavaScript - Stack Overflow

Once you're able to access the data layer from within the iframe via console, you can use that code to assign data elements.

2 replies

Level 2
Mar 28, 2019 1:57 PM UTC

Hi, Can I have straight answer on how to get access of data elements in to iFrame created by DTM (Non Sequential HTML) script? Above answer won't make much sense to me.

Regards

Translate
Gigazelle
GigazelleAccepted solution
Employee
Sep 14, 2018 6:30 PM UTC

If you can access them via the browser console, you can access them in DTM. Try accessing the data layer from the console using some suggestions off of StackOverflow:

How to access parent Iframe from JavaScript - Stack Overflow

Once you're able to access the data layer from within the iframe via console, you can use that code to assign data elements.

Translate