Lisa1
July 26, 2019, 10:05am
1
Hello!
I searched the forum and googled a ton but couldn’t find a solution yet.
I have Media Analytics Plugin installed. It says, that it supports videoJS and that the tracking of Youtube Video title is done automatically.
When I load youtube videos with VideoJS and inspect the generated youtube iframe I can see it has a generic title="YouTube video player"
attribute set. This title is then tracked by Matomo.
There is not point in tracking such a generic title. Do you know how to get the actual video title or at least how to overwrite this default one?
Thank you!
karthik
(Karthik Rajendran)
August 2, 2019, 1:36am
2
Lisa1
August 2, 2019, 9:00am
3
Hi Karthik!
Yes, the data-matomo-title attribute would be perfect. Unfortunately I didn’t find a way to add it to the generated iframe. Maybe it’s a videojs issue, but since I read Matomo supports videojs and this is such a common use case I thought there must already be a straight forward way to do this.
Source code:
<script>
jQuery(document).ready(function() {
if (jQuery("#video_js_1073503_4768").length > 1) {
videojs(document.getElementById("video_js_1073503_4768"), {
"techOrder": ["youtube"],
"sources": [{ 'type': 'video/youtube', 'youtube': { 'iv_load_policy': 1 }, 'src': 'https://www.youtube.com/watch?v=Eh44QPT1mPE' }],
"controlBar": {}
}).one(["waiting", "pause", "playing"], function() {
var that = this;
window.onbeforeunload = function(event) {
that.currentTime(that.duration());
};
});
}
});
</script>
<video id="video_js_1073503_4768" title="My Custom Matomo Youtube Title 123" data-matomo-title="My Custom Matomo Youtube Title 123" alt="My Custom Matomo Youtube Title 123" class="video-js vjs-default-skin vjs-big-play-centered vjs-16-9 akyt" controls preload="auto" width="640" height="264" poster='https://img.youtube.com/vi/Eh44QPT1mPE/0.jpg' data-setup='{ "techOrder": ["youtubeak"], "sources": [{ "type": "video/youtube", "src": "https://www.youtube.com/watch?v=Eh44QPT1mPE"}] }'>
</video>
After page load in DOM:
<div tabindex="-1" data-setup="{ "techOrder": ["youtube"], "sources": [{ "type": "video/youtube", "src": "https://www.youtube.com/watch?v=Eh44QPT1mPE"}] }" poster="https://img.youtube.com/vi/Eh44QPT1mPE/0.jpg" preload="auto" class="video-js vjs-default-skin vjs-big-play-centered vjs-16-9 akyt vjs-paused video_js_1073503_4768-dimensions vjs-controls-enabled vjs-workinghover vjs-v6 vjs-youtube vjs-user-inactive" alt="My Custom Matomo Youtube Title 123" data-matomo-title="My Custom Matomo Youtube Title 123" title="My Custom Matomo Youtube Title 123" id="video_js_1073503_4768" lang="de" role="region" aria-label="Video Player">
<div>
<iframe id="video_js_1073503_4768_Youtube_api" style="width:100%;height:100%;top:0;left:0;position:absolute" class="vjs-tech" frameborder="0" allowfullscreen="1" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" title="YouTube video player" width="640" height="360" src="https://www.youtube.com/embed/Eh44QPT1mPE?controls=0&modestbranding=1&rel=0&showinfo=0&loop=0&fs=0&hl=de&enablejsapi=1&origin=https%3A%2F%2Fmywebsitedomain.com&widgetid=1" enablejsapi="1"></iframe>
...
Matomo tracks “YouTube video player”.
karthik
(Karthik Rajendran)
August 6, 2019, 11:02pm
4
Could you please contact our Support team at support@matomo.cloud and tag this conversation.