0

how can i track non-youtube video in below scenario.

<a src="some vodeo url"><a/>

After playing the video, it generates an Iframe next to the anchor tag. Under the Iframe, I can see #document, html code and video tag inside the body tag.

<a src="some vodeo url"></a>
<iframe src="some vodeo url">
#document
<HTML><BODY><video src="some vodeo url" media></video></body></html>
</iframe>

I am not able to access video tag in DTM or browser console unless i go to browser elements(inspect elements) and expand Iframe until the 'video' tag is visible.

Suggest a solution how can to track this "non-youtube video" without affecting the iframe.

  • If the iframe is not hosted on the same domain as the parent page, you cannot access it. If it is the same domain, see https://stackoverflow.com/questions/1088544/get-element-from-within-an-iframe – CrayonViolent Dec 11 '19 at 19:30
  • It is in different domain and a few times i get error related to cross site. For Youtube videos the scenario works by using YT-API suggested by Adobe. Can similar code in JS script work for non-youtube video after some tweaking? Although i tried that but still if you might have worked on such case ? – Tarun Prakash Dec 17 '19 at 05:55
  • The Youtube API works because Youtube sets the iframe server to allow cross-site scripting and uses the js `postMessage` API with code on both the iframe and parent frame to communicate to each other, and has a framework built around that to have callback functions for you to subscribe to. You will need to do similar on your end to achieve the same thing. If you do not have control over the iframe domain then you cannot do this, no. But even if you do, it's a lot more work than just some js snippet to c/p. – CrayonViolent Dec 17 '19 at 17:57

0 Answers0