Revision 54722
Added by Myrto Koukouli over 5 years ago
app.component.ts | ||
---|---|---|
1 | 1 |
import { Component, OnInit } from '@angular/core'; |
2 |
import { NavigationEnd, Router } from '@angular/router'; |
|
2 |
import { NavigationEnd, Router, RoutesRecognized } from '@angular/router';
|
|
3 | 3 |
import { AuthenticationService } from './services/authentication.service'; |
4 | 4 |
import { environment } from '../environments/environment'; |
5 |
import { MatomoInjector } from 'ngx-matomo'; |
|
5 | 6 |
|
6 | 7 |
@Component({ |
7 | 8 |
selector: 'oa-repo-manager', |
... | ... | |
12 | 13 |
piwikUrl: string; |
13 | 14 |
|
14 | 15 |
constructor(private router: Router, |
15 |
private authService: AuthenticationService) { |
|
16 |
private authService: AuthenticationService, |
|
17 |
private matomoInjector: MatomoInjector) { |
|
18 |
|
|
16 | 19 |
/*disabling console.log in production*/ |
17 | 20 |
if ( environment.production === true ) { |
18 | 21 |
console.log = function () {}; |
... | ... | |
30 | 33 |
} |
31 | 34 |
|
32 | 35 |
ngOnInit() { |
33 |
/*if ((window.location.origin).includes('beta') || |
|
34 |
(window.location.origin).includes('athenarc') ) { |
|
35 |
this.piwikUrl = 'https://analytics.openaire.eu/piwik.php?idsite=92&rec=1'; |
|
36 |
} else { |
|
37 |
this.piwikUrl = 'https://analytics.openaire.eu/piwik.php?idsite=111&rec=1'; |
|
38 |
}*/ |
|
36 |
this.router.events.subscribe((evt) => { |
|
37 |
if (evt instanceof RoutesRecognized) { |
|
38 |
let piwikUrl; |
|
39 |
if (window.location.origin.includes('beta')) { |
|
40 |
// piwikUrl = 'https://analytics.openaire.eu/piwik.php?idsite=92&rec=1'; |
|
41 |
piwikUrl = '92'; |
|
42 |
} else { |
|
43 |
// piwikUrl = 'https://analytics.openaire.eu/piwik.php?idsite=111&rec=1'; |
|
44 |
piwikUrl = '111'; |
|
45 |
} |
|
46 |
this.matomoInjector.init('https://analytics.openaire.eu/', piwikUrl); |
|
47 |
} |
|
39 | 48 |
|
40 |
this.router.events.subscribe((evt) => { |
|
41 | 49 |
if (!(evt instanceof NavigationEnd)) { |
42 | 50 |
return; |
43 | 51 |
} |
Also available in: Unified diff
probably fixed piwik-matomo analytics script