add piwik & SEO services for SDGs and FOS pages

This commit is contained in:
Alex Martzios 2022-06-21 14:27:41 +03:00
parent 429ad98246
commit dc898d673d
2 changed files with 18 additions and 2 deletions

View File

@ -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);

View File

@ -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);