Wednesday, 15 November 2023

Triggering GTM Event Based on URL Change in Main Page Caused by Click Inside an Iframe

I am working on a web project where I have an iframe embedded in my main page (hosted on cba123.com). Within this iframe, there are links that, when clicked, change the URL of the main page to a different site (e.g., abc567.com).

I am looking to set up a trigger in Google Tag Manager (GTM) that detects this specific scenario: when a user clicks a link inside the iframe that results in the main page URL changing. Setting up triggers in GTM for regular links on the main page is straightforward, but I'm unsure how to handle this particular case with the iframe.

This iframe, crucially, is from a different domain, and I do not have the ability to modify its content or code. Also, there is no 'same-origin' relationship between the main page and the iframe content.

Can someone provide insights or guidance on how to set up a GTM trigger for this scenario? Is it possible to detect URL changes on the main page that are initiated by actions within an iframe?

Any suggestions or resources would be greatly appreciated.



from Triggering GTM Event Based on URL Change in Main Page Caused by Click Inside an Iframe

No comments:

Post a Comment