From 840d539a476fdb5997533d13962c0b8307289f48 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 15 Mar 2022 14:09:07 +0100 Subject: [PATCH] Support video media analytic --- peertube-plugin-matomo/client/common-client-plugin.js | 7 +++++++ peertube-plugin-matomo/package.json | 6 ++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/peertube-plugin-matomo/client/common-client-plugin.js b/peertube-plugin-matomo/client/common-client-plugin.js index c126219..c78e173 100644 --- a/peertube-plugin-matomo/client/common-client-plugin.js +++ b/peertube-plugin-matomo/client/common-client-plugin.js @@ -41,6 +41,13 @@ function initMatomo (registerHook, peertubeHelpers) { window._paq.push(['trackPageView']); } }) + + registerHook({ + target: 'action:video-watch.player.loaded', + handler: function () { + window._paq.push(['MediaAnalytics::scanForMedia', window.document]); + } + }) }) } diff --git a/peertube-plugin-matomo/package.json b/peertube-plugin-matomo/package.json index c5450d1..dbb9263 100644 --- a/peertube-plugin-matomo/package.json +++ b/peertube-plugin-matomo/package.json @@ -1,6 +1,6 @@ { "name": "peertube-plugin-matomo", - "version": "0.0.3", + "version": "0.0.4", "description": "Matomo plugin that tracks page views on a PeerTube instance.", "engine": { "peertube": ">=1.3.0" @@ -18,7 +18,9 @@ "clientScripts": [ { "script": "client/common-client-plugin.js", - "scopes": [ "common" ] + "scopes": [ + "common" + ] } ], "translations": {}