Foliovision › Forums › FV Player › Bug Reports › Matomo shows “Unknown” as video title sometimes and correct title sometimes
-
We are using FVPlayer Pro. The video title is correctly saved in FVPlayer. In Matomo plays of the same video (1 min 13 seconds long) is sometimes listed with its correct name and sometimes as “unknown”.
FVPlayer code implementation uses the following function to get the Video Title for tracking purposes:
function fv_player_track_name(e, t) { e = e.attr("title"); return (e = (e = e || void 0 === t.fv_title ? e : t.fv_title) || void 0 === t.title ? e : t.title) || void 0 === t.src || (e = t.src.split("/").slice(-1)[0].replace(/\.(\w{3,4})(\?.*)?$/i, ""), t.type.match(/mpegurl/) && (e = t.src.split("/").slice(-2)[0].replace(/\.(\w{3,4})(\?.*)?$/i, "") + "/" + e)), e }
So what may be happening in some cases is the tracking code implementation from FV Player is sometimes not correctly sending the Media Title with the tracking requests its sending for tracking the Video progress and other Media Analytics tracking events.
Is it possible the function code is not always returning the correct title?
The video title is saved in FVPlayer. Is there anything else to check?
=== From Matomo ===
TITLE|PLAYS|IMPRESSIONS|PLAY RATE|FINISHES|AVG. MEDIA LENGTH Trauma Healing|214|324|66%|27|1 min 13s Unknown|43|147|29%|1|1 min 13s
-
-
Hello Mark,
please let us know if you using Matomo’s Media Analytics.
I wonder if the video name could be failing for you somehow. Are you able to open the browser developer tools and go the the network tab?
Then enable “Preserve log” and watch the individual “matomo” requests as the video plays. In each of these you should see the proper
e_n
argument.Then please reload the page to see the “Video / Seconds played” event, it should be have the correct
e_n
in it as well. I’m attaching a screenshot from our website where I enabled Matomo briefly.If it’s all looking good, there might be something else trying to track the videos.
Thanks,
MartinThank you for the reply.
We are using Matomo’s Media Analytics.
I did not mention this in the ticket, but this only is happening on some of the visits to the site and not on all visits. So, it is working to correctly track the videos in most cases it seems.
I used developer tools as you recommended, but did not see the resulting error.
Matomo support wrote, “A Media Analytics tracking request usually starts with a “ma_” parameter (Only “Events” are tracking using a parameter such as e_a or e_n for example).”
I am going through the matomo_access.log.4, but have not seen evidence yet that points to the problem.
Thanks,
MarkHello Mark,
please let us know why do you need to use FV Player’s Matomo integration and Matomo Media Analytics at once.
It seems to me Matomo Media Analytics might be getting the video name in a way which does not work with FV Player. Perhaps we could improve that, but why use two tracking systems?
Thanks,
MartinMartin:
Thank you for your response and patience as we work through this issue with you and Matomo support. You asked, “why do you need to use FV Player’s Matomo integration and Matomo Media Analytics?” We are using Matomo so that we have one source of analytics, and it is a single source of keeping analytics for multiple systems.
For this issue I found seven occurrences in the course of one 24-hour period that generated the “Unknown” video error. This does not happen on every play of FVPlayer videos but only on some of them. That has made it hard to reproduce. Most videos keep the title, but some do not.
Below I pasted two lines from the matomo.access.log file. You can see in these lines that “ma_ti=” has nothing after it. This is causing the “Unknown” issue when it occurs. During the 24-hour period of this data, it occurred seven time.
What is yet unknown is whether this missing title is as a result of the Matomo tracking code not being able to detect the title or if FVplayer is in certain circumstances not correctly setting the Title attribute for the video element in the webpage itself.
If the title isn’t present when Matomo scans the video element, then it can’t set the title in the tracking request – but there isn’t a guarantee that the video title is not present in the video element or if the Matomo tracking code is not correctly detecting it. Matomo support has not been able to reproduce the issue so far – which is one of the reasons they tried to find similarities between the visits that didn’t correctly track the video title so that they could try and reproduce it with the same device and determine what is happening.
Ultimately the question that needs answering is: Is the video title attribute present in the page (In the video element) at the time that the Matomo tracking code sends the Media Analytics tracking request.
If we can answer that question, then we can make some good progress on finding the cause.Do you know if the video title attribute is present, or is there a possibility in the FVPlayer code that the video title attribute is not present?
two lines from matomo.access.log data that show no title was present (see ma_ti=):
< 172.70.143.71 - - [23/May/2022:16:18:40 +0000] "POST /matomo.php?ma_id=8Jd0so&ma_ti=&ma_pn=flowplayer&ma_mt=Video&ma_re=blob%3Ahttps%3A%2F%2Fwww.pinganlushang.com%2Fb5c1a95d-f635-449a-ace4-a14bc991945a&ma_st=0&ma_ps=0&ma_le=NaN&ma_ttp=&ma_w=312&ma_h=176&ma_fs=0&ma_se=&ca=1&&idsite=1&rec=1&r=198888&h=23&m=18&s=37&url=https%3A%2F%2Fwww.pinganlushang.com%2Fchaoyuekunan%2F&urlref=https%3A%2F%2Fwww.pinganlushang.com%2F&_id=4e1194f2403d9898&_idn=0&_refts=1653322673&_ref=https%3A%2F%2Fgoogleads.g.doubleclick.net%2Fpagead%2Fads%3Fclient%3Dca-pub-5346757008396557%26output%3Dhtml%26h%3D300%26slotname%3D9842898139%26adk%3D3206041887%26adf%3D2475645798%26pi%3Dt.ma~as.9842898139%26w%3D320%26psa%3D0%26format%3D320x300%26url%3Dhttps%3A%2F%2Fvivtp.com%26wgl%3D1%26dt%3D1653322631463%26bpp%3D19%26bdt%3D2550%26idt%3D4056%26shv%3Dr20220518%26mjsv%3Dm202205170101%26ptt%3D9%26saldr%3Daa%26abxe%3D1%26prev_fmts%3D0x0%26nras%3D1%26correlator%3D2087881946157%26frm%3D20%26pv%3D1%26ga_vid%3D25931609.1653322632%26ga_sid%3D1653322635%26ga_hid%3D137255261%26ga_fc%3D1%26u_tz%3D420%26u_his%3D1%26u_h%3D760%26u_w%3D360%26u_ah%3D760%26u_aw%3D360%26u_cd%3D32%26u_sd%3D2%26adx%3D20%26ady%3D165%26biw%3D360%26bih%3D586%26scr_x%3D0%26scr_y%3D0%26eid%3D44759876%2C44759927%2C44759842%2C44760475%2C44760911%2C31067721%26oid%3D2%26pvsid%3D982946628615816%26pem%3D902%26tmod%3D1453064670%26nvt%3D1%26ref%3Dhttps%3A%2F%2Ffun.touchpal.com%2FIME_games%2Fgather_v3%2Findex.html%26loc%3Dhttps%3A%2F%2Fvivtp.com%2FgameVivtp%2FgameNewList%2FlineMatch%2Findex.html%26eae%3D0%26fc%3D1920%26brdim%3D0%2C0%2C0%2C0%2C360%2C0%2C360%2C586%2C360%2C586%26vis%3D1%26rsz%3D%7C%7CaeE%7C%26abl%3DCA%26pfx%3D0%26fu%3D0%26bc%3D29%26ifi%3D2%26uci%3Da!2%26xpc%3Dl7iDdOyjIF%26p%3Dhttps%3A%2F%2Fvivtp.com%26dtd%3D4098&send_image=0&cookie=1&res=360x760&pf_net=0&pf_srv=1152&pf_tfr=285&pf_dm1=7488&pf_dm2=5650&pf_onl=25&pv_id=WqAXy2 HTTP/1.1" 204 267 "https://www.pinganlushang.com/chaoyuekunan/" "Mozilla/5.0 (Linux; Android 8.1.0; vivo 1820 Build/O11019; wv) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.84 Mobile Safari/537.36 VivoBrowser/5.9.1.5" 47d45 < 172.69.34.85 - - [23/May/2022:20:16:15 +0000] "POST /matomo.php?ma_id=TbP0a0&ma_ti=&ma_pn=flowplayer&ma_mt=Video&ma_re=https%3A%2F%2Fwww.pinganlushang.com%2Fcht%2Fchaoyuekunan%2F&ma_st=0&ma_ps=0&ma_le=&ma_ttp=&ma_w=336&ma_h=189&ma_fs=0&ma_se=&ca=1&&idsite=1&rec=1&r=017423&h=4&m=16&s=12&url=https%3A%2F%2Fwww.pinganlushang.com%2Fcht%2Fchaoyuekunan%2F&urlref=https%3A%2F%2F94f3a08c2e1b50f29b06340d82d960ce.safeframe.googlesyndication.com%2F&_id=e436d3fc79a5994f&_idn=0&_refts=1653336970&_ref=https%3A%2F%2F94f3a08c2e1b50f29b06340d82d960ce.safeframe.googlesyndication.com%2F&send_image=0&cookie=1&res=385x854&pf_net=413&pf_srv=196&pf_tfr=159&pf_dm1=1837&pf_dm2=1240&pf_onl=15&pv_id=nM2fk4 HTTP/1.1" 204 266 "https://www.pinganlushang.com/" "Mozilla/5.0 (Linux; Android 11; SM-A426B Build/RP1A.200720.012; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/101.0.4951.61 Mobile Safari/537.36" 179d176
Thanks,
MarkHello Mark,
we actually use the matomoTitle property which Matomo Media Analytics should support: https://developer.matomo.org/guides/media-analytics/options -> Flowplayer
Please confirm with Matomo what this kind of Flowplayer tracking actually works. Do they work with the actual flowplayer() function? If yes, then it should really work.
Are you able to check which pages are affected by this “Unknown” video issue and then check if the matomoTitle can be found in the HTML code?
Thanks,
MartinMartin:
Thank you for your answer. I relayed it to Matomo, and they said it was helpful. Most of the time the video name is recorded correctly in Matomo, but sometimes it is not. We have not found a pattern yet so that we can reproduce the error, so we do not know the source of the error. It could be a browser, device, FVPlayer or Matomo. Right now we are going to try to see if we can reproduce the error of see a pattern. I will try to contact you again if we can gain better insight or need your help to move closer to the solution. Thank you for you help so to this point.
Thanks,
MarkMartin:
Thanks for checking back. I wrote Matomo today and will let you know if they are using the flowplayer () function.
Matomo would like to see if we can recreate the problem. The problem does not always occur.
I have been trying to see if I can find any consistencies when the problem occurs compared to when it does not occur using the access log file.
Thanks,
MarkMartin:
Matomo answered your question below about whether they use the flowplayer() function.
Here is their answer:
Yes, the tracking code for the Media Analytics plugin uses the flowpleyer() function.
Here is the excerpt from the tracking code in matomo.js where it gets the title using the flowplayer() function:
if (n() && !ay.getMediaTitle()) { var ar = p.getFirstParentWithClass(au, "flowplayer", 4); if (ar) { var az = flowplayer(ar); if (az && az.video && az.video.matomoTitle) { ay.setMediaTitle(az.video.matomoTitle) } else { if (az && az.video && az.video.piwikTitle) { ay.setMediaTitle(az.video.piwikTitle) } else { if (az && az.video && az.video.title) { ay.setMediaTitle(az.video.title) } } } } }
As you’ll see from the example above, it checks for titles in the following order of preference: matomoTitle, piwikTitle, title
So as long as the flowplayer function has the title property set, the Matomo tracking code should be able to track it correctly.
Thanks,
MarkI was out of town but have returned. I relayed your questions to Matomo. This is their reply:
The code in question likely runs when the Matomo Javascript is loaded onto the page. However, it should be able to detect when a media object is loaded
into the page itself. We can confirm that this is happening at least partially since there are media tracking details being sent to Matomo (Such as media length, play/pause, etc.)P.S. The ay variable in this circumstance is likely the HTML element of the actual media object on the page. It’s a minified variable name, so it can
be tricky to understand it. You can see it being set in one example here:
var ay=p.getFirstParentWithClass(aw,”jwplayer”,3);
if(!ay){ay=p.getFirstParentWithClass(aw,”jwplayer-video”,3);As I get more information, I will let you know.
Thanks,
MarkHello Mark,
it’s all a bit unclear – for example
ay
seems to be a result of thep.getFirstParentWithClass()
call so I would guess it’s the HTML element of the video player. But then it calls getMediaTitle() on that element, so how is that defined?Does Matomo offer any debug mode which would let you see what happens with the
ay.getMediaTitle()
anday.setMediaTitle()
calls?Perhaps if you load the page several times that way you could see what sometimes it does not pick the FV Player video title.
Thanks,
MartinMartin:
I forwarded your questions to Matomo support team. They sent the following reply.
“You can find attached the non-minified version of the Heatmaps and Session Recordings JavaScript in a zip file.
The relevant part of the tracking code for flowplayer in relation to getting the Media Title is this:
if (hasFlowPlayer() && !tracker.getMediaTitle()) { var flowPlayerDiv = element.getFirstParentWithClass(node, 'flowplayer', 4); if (flowPlayerDiv) { var player = flowplayer(flowPlayerDiv); if (player && player.video && player.video.matomoTitle) { tracker.setMediaTitle(player.video.matomoTitle); } else if (player && player.video && player.video.piwikTitle) { tracker.setMediaTitle(player.video.piwikTitle); } else if (player && player.video && player.video.title) { tracker.setMediaTitle(player.video.title); } else if (player && player.video && player.video.fv_title) { tracker.setMediaTitle(player.video.fv_title); } } }
This should hopefully help the flowplayer team to understand how this is being set.
Thanks,
MarkHello Mark,
could you please send the whole JavaScript file? You should be able to attach it as a
*.txt
file in the worst case.I need to see when is the code executed. Does it properly detect start of video playback using an event, or does it do so on page load?
The tricky part is that it sometimes works. So perhaps it must not work on
ready
event, but wait for firstprogress
event on the video.Thanks,
MartinMartin:
Here is the file in txt format. Is this what you need?
Thanks,
Mark- This reply was modified 2 years, 3 months ago by Mária Stašová. Reason: .txt attachment sent via email
Hello Mark,
everything looks good in that file – the
ready
event is used in aflowplayer()
callback.Are you using any kind of JavaScript loading optimization such as deferred or asynchronous loading? Please try disabling that to see if it fixes the issue.
Are you using wp-admin -> FV Player -> Settings -> Integrations/Compatibility -> “Optimize FV Flowplayer JS loading”? I would suggest disabling that too.
Thanks,
Martin