From 3ca423094296857bd52509efd2af4e047147b39b Mon Sep 17 00:00:00 2001 From: "stefania.martziou" Date: Fri, 23 Jul 2021 09:09:36 +0000 Subject: [PATCH] Added matomo tracking --- package-lock.json | 27 +++++++++++++++++++++++++++ package.json | 3 ++- src/app/app.module.ts | 16 +++++++++++++++- src/environments/environment.beta.ts | 4 +++- src/environments/environment.prod.ts | 4 +++- src/environments/environment.ts | 4 +++- 6 files changed, 53 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index c281af089..4e956a371 100644 --- a/package-lock.json +++ b/package-lock.json @@ -27,6 +27,7 @@ "jquery": "^3.4.1", "jspdf": "^1.5.3", "ngx-echarts": "^4.2.2", + "ngx-matomo": "^1.0.0-rc.0", "proj4": "^2.5.0", "rxjs": "~6.6.7", "tslib": "^2.0.0", @@ -10137,6 +10138,22 @@ "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==" }, + "node_modules/ngx-matomo": { + "version": "1.0.0-rc.0", + "resolved": "https://registry.npmjs.org/ngx-matomo/-/ngx-matomo-1.0.0-rc.0.tgz", + "integrity": "sha512-TTrVr/VhjD/vrH/c332Zropz3q7YoSja6S8eJjCuoZLtOjFYYQ2blDCiMKryQIS9Dsgbzed3FDVnQtgto1k2ZA==", + "dependencies": { + "tslib": "^2.0.0" + }, + "optionalDependencies": { + "@angular/router": ">=9.0.0 <13.0.0", + "rxjs": "^6.5.0" + }, + "peerDependencies": { + "@angular/common": ">=9.0.0 <13.0.0", + "@angular/core": ">=9.0.0 <13.0.0" + } + }, "node_modules/nice-try": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.5.tgz", @@ -25866,6 +25883,16 @@ } } }, + "ngx-matomo": { + "version": "1.0.0-rc.0", + "resolved": "https://registry.npmjs.org/ngx-matomo/-/ngx-matomo-1.0.0-rc.0.tgz", + "integrity": "sha512-TTrVr/VhjD/vrH/c332Zropz3q7YoSja6S8eJjCuoZLtOjFYYQ2blDCiMKryQIS9Dsgbzed3FDVnQtgto1k2ZA==", + "requires": { + "@angular/router": ">=9.0.0 <13.0.0", + "rxjs": "^6.5.0", + "tslib": "^2.0.0" + } + }, "nice-try": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.5.tgz", diff --git a/package.json b/package.json index d5d1d68bf..d23bb92f2 100644 --- a/package.json +++ b/package.json @@ -31,6 +31,7 @@ "jquery": "^3.4.1", "jspdf": "^1.5.3", "ngx-echarts": "^4.2.2", + "ngx-matomo": "^1.0.0-rc.0", "proj4": "^2.5.0", "rxjs": "~6.6.7", "tslib": "^2.0.0", @@ -45,6 +46,7 @@ "@types/jasmine": "~3.6.0", "@types/jasminewd2": "~2.0.3", "codelyzer": "^6.0.0", + "eslint": "^7.30.0", "jasmine-core": "~3.6.0", "jasmine-spec-reporter": "~5.0.0", "karma": "~6.3.4", @@ -53,7 +55,6 @@ "karma-jasmine": "~4.0.0", "protractor": "~7.0.0", "ts-node": "~7.0.0", - "eslint": "^7.30.0", "typescript": "~4.3.5" } } diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 0e0b8f4b4..139a8d2cb 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -23,6 +23,8 @@ import * as echarts from 'echarts'; import { AutocompleteLibModule } from 'angular-ng-autocomplete'; import { TopmenuComponent } from './shared/topmenu/top-menu.component'; import { TreemapHighchartsComponent } from './chart-components/treemap-highcharts/treemap-highcharts.component'; +import { MatomoModule } from 'ngx-matomo'; +import {environment} from '../environments/environment'; @NgModule({ declarations: [ @@ -49,7 +51,19 @@ import { TreemapHighchartsComponent } from './chart-components/treemap-highchart // }), NgxEchartsModule, HighchartsChartModule, - AutocompleteLibModule + AutocompleteLibModule, + MatomoModule.forRoot({ + scriptUrl: environment.MATOMO_URL + 'matomo.js', + trackers: [ + { + trackerUrl: environment.MATOMO_URL + 'matomo.php', + siteId: environment.MATOMO_SITE_ID + } + ], + routeTracking: { + enable: true + } + }), ], providers: [ DataService, diff --git a/src/environments/environment.beta.ts b/src/environments/environment.beta.ts index e8357a231..9074455f2 100644 --- a/src/environments/environment.beta.ts +++ b/src/environments/environment.beta.ts @@ -5,5 +5,7 @@ export const environment = { API_ENDPOINT: 'https://beta.services.openaire.eu/stats-tool/', FAQ_ENDPOINT: '/uoa-admin-tools/api', FAQ_HOMEPAGE: '/uoa-admin-tools/dashboard', - profileName: 'observatory' + profileName: 'observatory', + MATOMO_URL: 'https://analytics.openaire.eu/', + MATOMO_SITE_ID: 508 }; diff --git a/src/environments/environment.prod.ts b/src/environments/environment.prod.ts index 23643a7eb..1981e7ffc 100644 --- a/src/environments/environment.prod.ts +++ b/src/environments/environment.prod.ts @@ -7,5 +7,7 @@ export const environment = { FAQ_ENDPOINT: '/uoa-admin-tools/api', FAQ_HOMEPAGE: '/uoa-admin-tools/dashboard', // profileName: 'OpenAIRE All-inclusive' - profileName: 'observatory' + profileName: 'observatory', + MATOMO_URL: 'https://analytics.openaire.eu/', + MATOMO_SITE_ID: 509 }; diff --git a/src/environments/environment.ts b/src/environments/environment.ts index 55a2e0dd2..98055c7dd 100644 --- a/src/environments/environment.ts +++ b/src/environments/environment.ts @@ -11,7 +11,9 @@ export const environment = { // API_ENDPOINT: 'https://beta.services.openaire.eu/stats-tool/', FAQ_ENDPOINT: 'http://audrey.athenarc.gr:5555/api', FAQ_HOMEPAGE: 'http://audrey.athenarc.gr:5555', - profileName: 'observatory' + profileName: 'observatory', + MATOMO_URL: 'https://providers.eosc-portal.eu/matomo/', + MATOMO_SITE_ID: 3 }; /*