Implement click event on iFrame | Community
Skip to main content
LeoS_Taco
Level 2
January 19, 2018
Solved

Implement click event on iFrame

  • January 19, 2018
  • 3 replies
  • 5058 views

Hello there, I have an iFrame on a page and I'd like to fire a click event when a user clicks on the iframe. I don't really care about putting DTM code on the iframe, I just want to fire a click event when someone simply clicks on the container div itself. I've built a rule and applied every bubbling condition and element classname possible and the most I got was a rule-fire on the very edge of the container. Does anyone know how or why this is?

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 appuriabhi

Hi LeoS_Taco - I don't think we can track clicks on IFRAME embedded and referring to third party domains, however if it was hosted on same domain and you'don't want to add DTM library - you can use window.postMessage API for the same to set direct call rules.

3 replies

Level 8
January 21, 2018

Is the iframe hosted on the same domain as the parent page?

LeoS_Taco
LeoS_TacoAuthor
Level 2
January 22, 2018

No it's a Facebook widget, so it just has a Facebook posts on it.

appuriabhiAccepted solution
Level 2
January 24, 2018

Hi LeoS_Taco - I don't think we can track clicks on IFRAME embedded and referring to third party domains, however if it was hosted on same domain and you'don't want to add DTM library - you can use window.postMessage API for the same to set direct call rules.