From 3f641571365dbe549339091f32f0d980e0474250 Mon Sep 17 00:00:00 2001 From: "argiro.kokogiannaki" Date: Thu, 11 Mar 2021 13:27:30 +0000 Subject: [PATCH] [Library|Trunk] - piwik update: for result landing create custom url using the url format with the dedup id - result landing service: url encode pid for search service - update message for orcid git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@60625 d315682c-612b-4755-9ff5-7f18f6832af3 --- .../result/resultLanding.component.ts | 2 +- landingPages/result/resultLanding.service.ts | 2 +- orcid/orcid-work.component.ts | 6 +-- utils/piwik/piwik.service.ts | 37 +++++++++++++------ 4 files changed, 30 insertions(+), 17 deletions(-) diff --git a/landingPages/result/resultLanding.component.ts b/landingPages/result/resultLanding.component.ts index af62e942..a84df41e 100644 --- a/landingPages/result/resultLanding.component.ts +++ b/landingPages/result/resultLanding.component.ts @@ -368,7 +368,7 @@ export class ResultLandingComponent { this.updateDescription((this.resultLandingInfo.description ? (this.resultLandingInfo.description) : ("," + this.resultLandingInfo.title))); } if (this.properties.enablePiwikTrack && (typeof document !== 'undefined')) { - this.subscriptions.push(this._piwikService.trackView(this.properties, this.resultLandingInfo.title/*.name*/, this.piwikSiteId).subscribe()); + this.subscriptions.push(this._piwikService.trackViewForCustomUrl(this.properties, this.resultLandingInfo.title, this.linkToLandingPage.split("?")[1] + this.id ,this.piwikSiteId).subscribe()); } let bioentitiesNum = 0; diff --git a/landingPages/result/resultLanding.service.ts b/landingPages/result/resultLanding.service.ts index 238f7393..a428142a 100644 --- a/landingPages/result/resultLanding.service.ts +++ b/landingPages/result/resultLanding.service.ts @@ -38,7 +38,7 @@ export class ResultLandingService { } else if (identifier) { // pid = "10.3389/fphys.2014.00466"; let url = properties.searchAPIURLLAst + "resources2"; - url += "?pid="+identifier.id + "&pidtype=" + identifier.class + "&type="; + url += "?pid="+encodeURIComponent(identifier.id) + "&pidtype=" + identifier.class + "&type="; if (type === 'publication') { url += 'publications'; } else if (type === 'dataset') { diff --git a/orcid/orcid-work.component.ts b/orcid/orcid-work.component.ts index 2e23f7d5..bbabdc3d 100644 --- a/orcid/orcid-work.component.ts +++ b/orcid/orcid-work.component.ts @@ -294,9 +294,9 @@ declare var UIkit: any; [classBody]="'landing-modal uk-padding-remove'">
- This research outcome has been deduplicated in OpenAIRE. + This research outcome is the result of merged research outcomes in OpenAIRE.

- You have already added {{this.putCodes?.length}} works in your ORCID record related to this research outcome. + You have already added {{this.putCodes?.length}} works in your ORCID record related to the merged research outcome.
If you continue with delete action, all these works will be deleted.
@@ -757,4 +757,4 @@ export class OrcidWorkComponent { } this.showLoading = false; } -} \ No newline at end of file +} diff --git a/utils/piwik/piwik.service.ts b/utils/piwik/piwik.service.ts index 23eed81d..b72b4453 100644 --- a/utils/piwik/piwik.service.ts +++ b/utils/piwik/piwik.service.ts @@ -3,28 +3,41 @@ import {HttpClient} from "@angular/common/http"; import {StringUtils} from '../string-utils.class'; import {EnvProperties} from '../properties/env-properties'; +import {Observable} from "rxjs"; @Injectable() export class PiwikService { constructor(private http: HttpClient ) {} - + trackViewForCustomUrl (properties:EnvProperties, title, pageparams, siteId = null):any { + let piwikId= ((siteId!=null)?siteId:properties.piwikSiteId); + if(typeof location !== 'undefined' && piwikId){ + return this.doTrackView(properties,title,piwikId,location.href.split("?")[0] + "?" + pageparams); + } + } trackView (properties:EnvProperties, title, siteId = null):any { - - let ua = this.getUserAgent(); - let referrer = this.getReferrer(); let piwikId= ((siteId!=null)?siteId:properties.piwikSiteId); if(typeof location !== 'undefined' && piwikId){ - var url = properties.piwikBaseUrl+piwikId+"&rec=1&url="+StringUtils.URIEncode(location.href)+"&action_name="+StringUtils.URIEncode(title)+ - ((ua != null && ua.length > 0)?('&ua='+StringUtils.URIEncode(ua)):'')+ - ((referrer != null && referrer.length > 0)?('&urlref='+StringUtils.URIEncode(referrer)):''); - //console.log("Piwik - View: " + url); - // return Observable.of(new Object()).mapTo(true); // for testing - return this.http.get( url, {responseType: 'blob'}); - // .do(request => console.info("Piwik request completed" )); - + return this.doTrackView(properties,title,piwikId,location.href); } } + private doTrackView (properties:EnvProperties, title, siteId, pageURL):any { + + let ua = this.getUserAgent(); + let referrer = this.getReferrer(); + let piwikId= ((siteId!=null)?siteId:properties.piwikSiteId); + if(typeof location !== 'undefined' && piwikId){ + console.log("Piwik - View: " + pageURL, title); + var url = properties.piwikBaseUrl+piwikId+"&rec=1&url="+StringUtils.URIEncode(pageURL)+"&action_name="+StringUtils.URIEncode(title)+ + ((ua != null && ua.length > 0)?('&ua='+StringUtils.URIEncode(ua)):'')+ + ((referrer != null && referrer.length > 0)?('&urlref='+StringUtils.URIEncode(referrer)):''); + console.log("Piwik - View: " + url); + // return Observable.of(new Object()); // for testing + return this.http.get( url, {responseType: 'blob'}); + // .do(request => console.info("Piwik request completed" )); + + } + } trackDownload (properties:EnvProperties, type = "", siteId = null):any { var ua = this.getUserAgent(); var referrer = this.getReferrer();