Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Matomo Plugin review #5

Open
mliradelc opened this issue Sep 20, 2022 · 11 comments
Open

Matomo Plugin review #5

mliradelc opened this issue Sep 20, 2022 · 11 comments

Comments

@mliradelc
Copy link

Continuing the talk from #4

I've tried the plugin locally, now works with Paella standalone, but I've found two problems.

  • The event timeupdate is triggering a new event in Matomo each couple of milliseconds, thus making a lot of queries to Matomo server. That event is automatically recorded by Matomo using the heartbeat (See paella 6).
  • The Media Analytics are not sent to Matomo, Maybe needs to add a fallback like the one was added in paella 6

I will try to integrate to ilias and see the behavior with this version of Matomo

@miesgre
Copy link
Collaborator

miesgre commented Sep 21, 2022

The event TIMEUPDATE is triggered because it is configured in the config.json

"es.upv.paella.userEventTracker": {
"enabled": true,
"context": "userTracking",
"events": [
"PLAY",
"PAUSE",
"STOP",
"ENDED",
"SEEK",
"FULLSCREEN_CHANGED",
"VOLUME_CHANGED",
"TIMEUPDATE",
"CAPTIONS_CHANGED",
"BUTTON_PRESS",
"SHOW_POPUP",
"HIDE_POPUP",
"LAYOUT_CHANGED",
"PLAYBACK_RATE_CHANGED",
"RESIZE_END"
]
},

You can prevent the TIMEUPDATE event from being logged by removing the event from the list. Only the events from the list are logged.

About The Media Analytics are not sent to Matomo. What do you mean? Is the title of the page not logged?
I made tests in my media portal, and page titles are logged.

@mliradelc
Copy link
Author

Thanks for the hint, I didn't know that the plugin is subordinated to userEventTracker plugin, about Media Analytics, when Matomo detects that is a media, adds to the queries the ma_* data to the post queries, I haven't seen them, but it could be a configuration thing.

I will make more tests with Opencast.

@mliradelc
Copy link
Author

I've made more tests with the plugin in Opencast and I tested against the version PP 6,

  • The suggestion with the deletion of Timeupdate variable fixed the issue with the several queries.
  • The heartbeat doesn't work (It seems that in PP 6 also is not working but makes a query each 60 seconds, so works well)
  • The media analytics are not being recorded. PP6 gives you this data (As example):
ma_id: vuRBsM
ma_ti: Paella test
ma_pn: paella-opencast
ma_mt: Video
ma_re: http://localhost:8080/static/mh_default_org/engage-player/318807df-c531-4f7b-b6ed-6d391235fc63/98dd03c6-7b56-4cbd-bcaa-51158db417c6/387a9ae5-34d6-4508-99db-27a61be1e16e.mp4
ma_st: 61
ma_ps: 60
ma_le: 634
ma_ttp: 0
ma_w: 1280
ma_h: 720
ma_fs: 0
ma_se: 75

Finally, your repo, https://github.com/miesgre/opencast/tree/paella7-matomo gives me compilation errors from ESLint with the Matomo plugin, fortunately, the merge request from Dependabot works and compiles without any issue.

@miesgre
Copy link
Collaborator

miesgre commented Nov 9, 2022

Hi @mliradelc,
I updated the matomo opencast plugin (see this branch https://github.com/miesgre/opencast/tree/paella7-matomo). Can you test if it is working for you?

You will need to enable org.opencast.paella.matomo.userTrackingDataPlugin and org.opencast.paella.cookieconsent plugins.

@mliradelc
Copy link
Author

Thanks @miesgre ! I will try this with opencast and with ilias also :)

@snoesberger
Copy link
Contributor

The Media Analytics are not sent to Matomo, Maybe needs to add a fallback like the one was added in paella 6

I've just noticed that Paella 7 doesn't send statistics to the Matomo Media Analytics plugin (as @mliradelc already mentioned). I tested it on our Opencast 14 installation, Paella 6 works fine and sends the ma_* data regularly, but this is not the case with Paella 7. Paella 7 sends the standard information but not the Media Analytics Plugin data (ma_* data) to the configured Matomo instance. Without this data we can't analyse f. ex. how long a video was watched, which parts of the video were played how often or which video resolution was played.
We would therefore be very happy if this feature could be added again. This would make it easier for us to migrate from Paella 6 to 7.

@snoesberger
Copy link
Contributor

I have some new findings about the problems with the Matomo Media Analytics plugin. In Tobira, with the fix from @LukasKalbertodt (#7, Tobira PR: elan-ev/tobira#1139) statistic data for the Media Analytics plugin is now send from Paella within Tobira to Matomo. But what is still missing, is the video title information. This looks to me like the problem which was also present in Paella 6 and fixed by this commit: polimediaupv/paella@2a65b3e. This document describes how the Media Analytics plugin determines the title information: https://developer.matomo.org/guides/media-analytics/setup. The title information is essential in Matomo, without this information all Media Analytics statistic data is summarized under the video title "unknown".

I did also test the version 1.42.1 of the paella-user-tracking (which includes the PR from @LukasKalbertodt) with Opencast. But in this case no Media Analytics statistic data is send at all to Matomo (just the standard statistics are send). For both of the tests with Tobira and Opencast I used the same Matomo installation and almost the same configuration. The only difference in the configuration was, that in Tobira matomoGlobalLoaded was set to true. Can this setting have an impact on if data is send for the Matomo Media Analytics plugin? What has to be done so that Media Analytics data is also send if matomoGlobalLoaded is set to false?

@miesgre would you prefer to have two separate issues, one for the title problem and one for the Matomo Media Analytics? Please let me know if you need more information or some Matomo testing possibilities. I'll be happy to help.

@luniki
Copy link
Contributor

luniki commented May 17, 2024

To reproduce the reported issues I have setup an Opencast instance (based on the Uni Bern testing branch) and a running Matomo instance (both locally on my computer).

I have then updated the paella-user-tracking dependency of the engage-paella-player-7 module to v1.42.2
And I enabled and configured es.upv.paella.userEventTracker and org.opencast.paella.matomo.userTrackingDataPlugin in /etc/ui-config/mh_default_org/paella7/config.json.

My browser sends the user tracking events to my Matomo:
Selection_096

And then they show up in my Matomo:
image

I guess it's just working now!?

@snoesberger
Copy link
Contributor

I guess it's just working now!?

No, not for the Media Analytics Plugin. What you see in the browser console are the basic statistics data send to Matomo. But all the statistics data for the Matomo Media Analytics Plugin are still missing. Without this data the "Media" section in Matomo will remain empty.

If you use Paella 6 instead of Paella 7 in your installation, you will see that parameters like ma_id, ma_ti, etc. are sent to the Matomo server. In case of Paella 7 these parameters aren't sent.

@luniki
Copy link
Contributor

luniki commented May 21, 2024

Okay, I understand now. I do not have the MediaAnalytics plugin in my local installation and that's why i can't reproduce this. I will ask Katrin for help.

@luniki
Copy link
Contributor

luniki commented May 24, 2024

I traced back the problem that prevented the MediaAnalytics plugin from initializing:

There are several other potential occurrences of this problem. For example

bindEvent(this.player, Events.COOKIE_CONSENT_CHANGED, () => {
this.player.log.debug('Matomo: Cookie consent changed.');
if (this.player.cookieConsent.getConsentForType(this.config.cookieType)) {
// _paq.push(['rememberConsentGiven']);
_paq.push(['rememberCookieConsentGiven']);
}

I have created a patch for this problem by removing all local _paq variables and using window._paq exclusively:

luniki@274d0c8

(I could have declared a /* global _paq */ but found this more explicit.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants