I am having problems with media tracking for youtube. If I follow your instructions in the docs (having an iframe element in the DOM) it works.
However upon creating an iframe element with the Youtube Player API no media events get tracked at all. I would expect it to track it as well since the DOM output of the API is again an iframe element having an id that gets passed to the enableYouTubeTracking function
So at this point my questions are:
is this something that should work or not?
if yes could somebody please point me into the right direction how to achieve this
I also tested it with another library (react-youtube which is basically an abstraction layer of what I am doing right now - and no tracking events get emitted from there as well. So I wanted to make sure that the library is not the problem which it seems is not since I am having these issues here as well.
Thank you for the information! You can also take a look on the working youtube example on our examples repository.
Could you maybe provide a codesandbox of the reproduction with these libraries or the way you structure it in your app?
(You can leave the collector URL as a placeholder)
Hey @pbl, based on the codesandbox this won’t work. Internally, the plugin also uses the onReady callback to know when it should attach the event listeners (see here).
Though, even without running enableYouTubeTracking in the onReady callback, there’s no guarantee we’d get our player in time to listen for the onReady callback in the plugin.
Thanks for raising this, I’ve made an issue you can follow.
Hey @greg-el. Appreciate your help. Just a thought… for externally created player maybe it would be possible to pass a player reference to the enableMediaTracking function. Then you should be able to add all your listeners that way.
the fix from github Issue #1141 works like a charm - thanks! During the implementation, we came a cross the youtube context iglu:com.youtube/youtube/jsonschema/1-0-0. The context is for our current video tracking use case way too granular. We could find an option to get rid of the context. But maybe we are missing something?
Hi Greg,
thanks for your help. Removing it via JavaScript enrichment is not ideal, since it can be confusing if client-side requests and warehouse data doesn’t match. Would be great to have that option in the plugin. Anyway, thank you very much for the suggestion and enrichment snipped!