Here you can find a guide on how to track embedded YouTube videos with the Webtrekk Mediatracking library in 3 easy steps.
Please note that you can only track videos that are on your page, not the ones on YouTube.com
You can download the configuration code from here. The default implementation of Webtrekk for pageviews is not included – but the code works in addition with any V3, V4 or V5 implementation.
In case you do not want to use the media tracking library and simple eventrequests are enough for your data profile, then might check out the guide here:
3 Steps to YouTube Mediatracking
- Make sure that Webtrekk is implemented on your page (V3, V4 or V5). For Mediatracking, another js file has to be loaded: https://support.webtrekk.com/hc/de/articles/115001526385-Mediatracking-v-4-1-4. All the other configuration we’ll do in step 3.
- Place dummy div container on your page where you want the YouTube Videos to appear. Add unique id attributes to each dummy container. The YouTube embed API, which we have to use in order to track media interactions, will replace those empty div containers with the video player.
- Insert the code that you find on the example page mention above or that you can download at the bottom of this page. In the playerInfoList array you need to enter all the information of the videos that you want to embed on your page. Have a look at the source code of the example page to get an idea about the properties.
That’s it! Now when a visitor starts a video, a mediarequest is fired. Every few seconds a pos request is fired, containing the current position, and when the visitor seeks, corresponding requests for that action are triggered.