diff --git a/junior/app/routes/application.js b/junior/app/routes/application.js index a968f6b8ef9..c5064dc16fa 100644 --- a/junior/app/routes/application.js +++ b/junior/app/routes/application.js @@ -3,6 +3,7 @@ import { service } from '@ember/service'; export default class ApplicationRoute extends Route { @service intl; + @service metrics; async beforeModel() { /* @@ -16,5 +17,6 @@ export default class ApplicationRoute extends Route { Pour régler ce problème, il faut définir une locale ayant un fichier dans le dossier de traduction. */ this.intl.setLocale('fr'); + this.metrics.initialize(); } } diff --git a/junior/config/environment.js b/junior/config/environment.js index 8a8a85de2df..1b5e8395366 100644 --- a/junior/config/environment.js +++ b/junior/config/environment.js @@ -13,8 +13,10 @@ module.exports = function (environment) { environment, locationType: 'history', rootURL: '/', - matomo: {}, - + metrics: { + enabled: analyticsEnabled, + matomoUrl: process.env.WEB_ANALYTICS_URL, + }, EmberENV: { EXTEND_PROTOTYPES: false, FEATURES: { @@ -46,10 +48,6 @@ module.exports = function (environment) { // ENV.APP.LOG_TRANSITIONS = true; // ENV.APP.LOG_TRANSITIONS_INTERNAL = true; // ENV.APP.LOG_VIEW_LOOKUPS = true; - if (analyticsEnabled) { - ENV.matomo.url = process.env.WEB_ANALYTICS_URL; - ENV.matomo.debug = true; - } } if (environment === 'test') { @@ -62,15 +60,8 @@ module.exports = function (environment) { ENV.APP.rootElement = '#ember-testing'; ENV.APP.autoboot = false; - ENV.APP.CHALLENGE_DISPLAY_DELAY = 0; - } - - if (environment === 'production') { - // here you can enable a production-specific feature - if (analyticsEnabled) { - ENV.matomo.url = process.env.WEB_ANALYTICS_URL; - } + ENV.metrics.enabled = false; } ENV['ember-component-css'] = { diff --git a/junior/package-lock.json b/junior/package-lock.json index 024d4e9972e..75a3a87d743 100644 --- a/junior/package-lock.json +++ b/junior/package-lock.json @@ -10,6 +10,7 @@ "hasInstallScript": true, "license": "AGPL-3.0", "devDependencies": { + "@1024pix/ember-matomo-tag-manager": "^2.4.3", "@1024pix/ember-testing-library": "^3.0.6", "@1024pix/eslint-config": "^1.3.8", "@1024pix/pix-ui": "^46.15.2", @@ -82,6 +83,15 @@ "node": "^20.18.0" } }, + "node_modules/@1024pix/ember-matomo-tag-manager": { + "version": "2.4.3", + "resolved": "https://registry.npmjs.org/@1024pix/ember-matomo-tag-manager/-/ember-matomo-tag-manager-2.4.3.tgz", + "integrity": "sha512-gsoFCZxMXO5purZh92WwgWyydRS/PftFr7+HRF9bRAHbPrqkd6NCmLEHvFZ9ETXKPB3SkF79Qh28SaljXTkb5g==", + "dev": true, + "dependencies": { + "@embroider/addon-shim": "^1.0.0" + } + }, "node_modules/@1024pix/ember-testing-library": { "version": "3.0.6", "resolved": "https://registry.npmjs.org/@1024pix/ember-testing-library/-/ember-testing-library-3.0.6.tgz", diff --git a/junior/package.json b/junior/package.json index 63e8729a5a8..2012339b88c 100644 --- a/junior/package.json +++ b/junior/package.json @@ -35,6 +35,7 @@ "test:lint": "run-p --continue-on-error test lint" }, "devDependencies": { + "@1024pix/ember-matomo-tag-manager": "^2.4.3", "@1024pix/ember-testing-library": "^3.0.6", "@1024pix/eslint-config": "^1.3.8", "@1024pix/pix-ui": "^46.15.2",