From dc898d673d63710459d7e931138b2616b0cb5c0f Mon Sep 17 00:00:00 2001 From: Alex Martzios Date: Tue, 21 Jun 2022 14:27:41 +0300 Subject: [PATCH] add piwik & SEO services for SDGs and FOS pages --- explore/src/app/fos/fos.component.ts | 10 +++++++++- explore/src/app/sdg/sdg.component.ts | 10 +++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/explore/src/app/fos/fos.component.ts b/explore/src/app/fos/fos.component.ts index 3809e982..940fab38 100644 --- a/explore/src/app/fos/fos.component.ts +++ b/explore/src/app/fos/fos.component.ts @@ -10,6 +10,8 @@ import {ActivatedRoute, Router} from "@angular/router"; import {Meta, Title} from "@angular/platform-browser"; import {Location} from "@angular/common"; import {StringUtils} from "../openaireLibrary/utils/string-utils.class"; +import {SEOService} from "../openaireLibrary/sharedComponents/SEO/SEO.service"; +import {PiwikService} from "../openaireLibrary/utils/piwik/piwik.service"; @Component({ selector: 'fos', @@ -44,11 +46,17 @@ export class FosComponent implements OnInit, OnDestroy { private route: ActivatedRoute, private _router: Router, private _meta: Meta, - private _title: Title + private _title: Title, + private seoService: SEOService, + private _piwikService: PiwikService ) {} ngOnInit() { + if (this.properties.enablePiwikTrack && (typeof document !== 'undefined')) { + this.subscriptions.push(this._piwikService.trackView(this.properties, this.pageTitle, this.properties.piwikSiteId).subscribe()); + } this.url = this.properties.domain + this.properties.baseLink + this._router.url; + this.seoService.createLinkForCanonicalURL(this.url); this.updateUrl(this.url); this.updateTitle(this.pageTitle); this.updateDescription(this.pageDescription); diff --git a/explore/src/app/sdg/sdg.component.ts b/explore/src/app/sdg/sdg.component.ts index f40a8244..54cf1e4f 100644 --- a/explore/src/app/sdg/sdg.component.ts +++ b/explore/src/app/sdg/sdg.component.ts @@ -10,6 +10,8 @@ import {OpenaireEntities} from "../openaireLibrary/utils/properties/searchFields import {StringUtils} from "../openaireLibrary/utils/string-utils.class"; import {Router} from '@angular/router'; import {Meta, Title} from "@angular/platform-browser"; +import {SEOService} from "../openaireLibrary/sharedComponents/SEO/SEO.service"; +import {PiwikService} from "../openaireLibrary/utils/piwik/piwik.service"; @Component({ selector: 'sdg', @@ -36,12 +38,18 @@ export class SdgComponent implements OnInit, OnDestroy { private httpClient: HttpClient, private refineFieldResultsService: RefineFieldResultsService, private _router: Router, private _meta: Meta, - private _title: Title + private _title: Title, + private seoService: SEOService, + private _piwikService: PiwikService ) {} ngOnInit() { this.loading = true; + if (this.properties.enablePiwikTrack && (typeof document !== 'undefined')) { + this.subscriptions.push(this._piwikService.trackView(this.properties, this.pageTitle, this.properties.piwikSiteId).subscribe()); + } this.url = this.properties.domain + this.properties.baseLink + this._router.url; + this.seoService.createLinkForCanonicalURL(this.url); this.updateUrl(this.url); this.updateTitle(this.pageTitle); this.updateDescription(this.pageDescription);