[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
This commit is contained in:
argiro.kokogiannaki 2021-03-11 13:27:30 +00:00
parent 04f8e00242
commit 3f64157136
4 changed files with 30 additions and 17 deletions

View File

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

View File

@ -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') {

View File

@ -294,9 +294,9 @@ declare var UIkit: any;
[classBody]="'landing-modal uk-padding-remove'">
<div class="uk-padding-small">
<div>
This research outcome has been <span class="uk-text-bold">deduplicated in OpenAIRE</span>.
This research outcome is the result of <span class="uk-text-bold"> merged research outcomes in OpenAIRE</span>.
<br><br>
You have already added <span class="uk-text-bold">{{this.putCodes?.length}} works</span> in your ORCID record related to this research outcome.
You have already added <span class="uk-text-bold">{{this.putCodes?.length}} works</span> in your ORCID record related to the merged research outcome.
<div *ngIf="currentAction == 'delete'">
If you continue with delete action, <span class="uk-text-bold">all these works will be deleted</span>.
</div>
@ -757,4 +757,4 @@ export class OrcidWorkComponent {
}
this.showLoading = false;
}
}
}

View File

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