From bdd129b9a2c6d98d384e6e53eeb2e33ec8a183cf Mon Sep 17 00:00:00 2001 From: ludovicm67 Date: Wed, 29 Apr 2020 12:40:04 +0200 Subject: [PATCH] feat(analytics): include MatomoHandler by default --- Makefile | 2 -- config.js | 5 ++--- react/features/analytics/functions.js | 9 ++++++++- react/features/analytics/handlers/MatomoHandler.js | 2 +- react/features/analytics/handlers/index.js | 1 + webpack.config.js | 6 ------ 6 files changed, 12 insertions(+), 13 deletions(-) diff --git a/Makefile b/Makefile index 7b0733e2a..0cb668e53 100644 --- a/Makefile +++ b/Makefile @@ -46,8 +46,6 @@ deploy-appbundle: $(OUTPUT_DIR)/analytics-ga.js \ $(BUILD_DIR)/analytics-ga.min.js \ $(BUILD_DIR)/analytics-ga.min.map \ - $(BUILD_DIR)/analytics-matomo.min.js \ - $(BUILD_DIR)/analytics-matomo.min.map \ $(BUILD_DIR)/video-blur-effect.min.js \ $(BUILD_DIR)/video-blur-effect.min.map \ $(BUILD_DIR)/rnnoise-processor.min.js \ diff --git a/config.js b/config.js index 5e03cd3b1..6504e47a6 100644 --- a/config.js +++ b/config.js @@ -380,9 +380,8 @@ var config = { // Array of script URLs to load as lib-jitsi-meet "analytics handlers". // scriptURLs: [ - // "libs/analytics-ga.min.js", // google-analytics - // "libs/analytics-matomo.min.js", // Matomo - // "https://example.com/my-custom-analytics.js" + // "libs/analytics-ga.min.js", // google-analytics + // "https://example.com/my-custom-analytics.js" // ], }, diff --git a/react/features/analytics/functions.js b/react/features/analytics/functions.js index 6dd66cd60..fb183eec1 100644 --- a/react/features/analytics/functions.js +++ b/react/features/analytics/functions.js @@ -10,7 +10,7 @@ import { checkChromeExtensionsInstalled, isMobileBrowser } from '../base/environment/utils'; -import { AmplitudeHandler } from './handlers'; +import { AmplitudeHandler, MatomoHandler } from './handlers'; import logger from './logger'; /** @@ -94,6 +94,13 @@ export function createHandlers({ getState }: { getState: Function }) { // eslint-disable-next-line no-empty } catch (e) {} + try { + const matomo = new MatomoHandler(handlerConstructorOptions); + + handlers.push(matomo); + // eslint-disable-next-line no-empty + } catch (e) {} + return ( _loadHandlers(scriptURLs, handlerConstructorOptions) .then(externalHandlers => { diff --git a/react/features/analytics/handlers/MatomoHandler.js b/react/features/analytics/handlers/MatomoHandler.js index 5efba6102..1dd69b001 100644 --- a/react/features/analytics/handlers/MatomoHandler.js +++ b/react/features/analytics/handlers/MatomoHandler.js @@ -7,7 +7,7 @@ import AbstractHandler from './AbstractHandler'; /** * Analytics handler for Matomo. */ -class MatomoHandler extends AbstractHandler { +export default class MatomoHandler extends AbstractHandler { /** * Creates new instance of the Matomo handler. diff --git a/react/features/analytics/handlers/index.js b/react/features/analytics/handlers/index.js index 9d56d43dc..e019d2600 100644 --- a/react/features/analytics/handlers/index.js +++ b/react/features/analytics/handlers/index.js @@ -1 +1,2 @@ export { default as AmplitudeHandler } from './AmplitudeHandler'; +export { default as MatomoHandler } from './MatomoHandler'; diff --git a/webpack.config.js b/webpack.config.js index a8d577a81..72407cfe5 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -217,12 +217,6 @@ module.exports = [ }, performance: getPerformanceHints(5 * 1024) }), - Object.assign({}, config, { - entry: { - 'analytics-matomo': './react/features/analytics/handlers/MatomoHandler.js' - }, - performance: getPerformanceHints(5 * 1024) - }), // Because both video-blur-effect and rnnoise-processor modules are loaded // in a lazy manner using the loadScript function with a hard coded name,