polimediaupv / paella-user-tracking

A set of plugins for user interaction tracking
0 stars 5 forks source link

Matomo Plugin review #5

Open mliradelc opened 2 years ago

mliradelc commented 2 years ago

Continuing the talk from #4

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

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

miesgre commented 2 years ago

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

https://github.com/polimediaupv/paella-user-tracking/blob/aa9d1b427012f66b9caaaad54ea1e5f67bd2ac4e/config/config.json#L77-L97

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 commented 2 years ago

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 commented 2 years ago

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

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 commented 1 year ago

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 commented 1 year ago

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

snoesberger commented 7 months ago

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 commented 6 months ago

I have some new findings about the problems with the Matomo Media Analytics plugin. In Tobira, with the fix from @LukasKalbertodt (https://github.com/polimediaupv/paella-user-tracking/pull/7, Tobira PR: https://github.com/elan-ev/tobira/pull/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: https://github.com/polimediaupv/paella/commit/2a65b3ea2485606adb3010b78fa759917d2e8a79. 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 commented 4 months ago

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 commented 4 months ago

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 commented 4 months ago

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 commented 4 months ago

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

There are several other potential occurrences of this problem. For example https://github.com/polimediaupv/paella-user-tracking/blob/0efda071e3783f2a40c5faaf4afd43a6eea39095/src/plugins/es.upv.paella.matomo.userTrackingDataPlugin.js#L95-L100

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

https://github.com/luniki/paella-user-tracking/commit/274d0c8ea35bca359cde472b83d3723a92f53d24

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