Google Analytics Track Youtube
Categories
Component ID
2769399
Component name
Google Analytics Track Youtube
Component type
module
Maintenance status
Development status
Component security advisory coverage
not-covered
Component created
Component changed
Component body
Track YouTube Player Events in Google Analytics.
Requirements
- Google Analytics
- Google Analytics account
- youtube-google-analytics script
Installation
- Download the
lunametrics-youtube.gtm.jsscript from https://github.com/lunametrics/youtube-google-analytics and install to/libraries/youtube-google-analytics/ - Enable the module
Usage
By default, the lunametrics-youtube.gtm.js script will be attached to all pages. To modify which pages the youtube-google-analytics script is attached to use hook_page_attachments() override with your custom logic.
The script will send tracking events when users Play, Pause, Watch to End, and watch 10%, 25%, 50%, 75%, and 90% of each video on the page. These defaults can be adjusted by modifying the object passed as the third argument at the bottom of the lunametrics-youtube.gtm.js script.
Acknowledgements
This module is nothing without the wonderful youtube-google-analytics script from LunaMetrics
Brought to you by your friends at Socha Dev.
