Bounteous-Inc / youtube-google-analytics

YouTube Google Analytics Embed Tracking
MIT License
232 stars 89 forks source link

Angulartics via Google Tag Manager and LunaMetrics YouTube Tracking (not picking up events) #31

Closed danrye closed 8 years ago

danrye commented 9 years ago

I've got angulartics working. I can't get LunaMetrics working, I've followed the instructions using the .json file to configure GTM. My guess is that there is something that needs changed with the triggers.

danrye commented 9 years ago

I've been working on this a little more, it seems related to the fact that init is being called before the angular app had had a chance to completely load. If you have some tips for getting this script working for angular apps I'd be happy to submit a pull request with a section added to the readme.

DanWilkerson commented 9 years ago

Yep, you got it. This script is designed to run after your YouTube videos are in the DOM. You can invoke onYouTubeIframeAPIReady inside of a directive in order to re-bind to new videos in the DOM, but beware that there's currently a known issue where the script will break when bound on the same video twice.

I'm definitely interested in suggestions, as this is a persistent problem. Short of polling for new YouTube videos and keeping a cache/count of bound videos, I'm coming up short on ideas.