Merge Angular 16 Irish Monitor to develop #33
|
@ -69,6 +69,22 @@ export class PiwikService {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private doTrackEvent(properties: EnvProperties, title, siteId, pageURL, eventCategory, eventAction, eventName, eventValue = 0): Observable<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=${encodeURIComponent(pageURL)}&action_name=${encodeURIComponent(title)}&e_c=${encodeURIComponent(eventCategory)}&e_a=${encodeURIComponent(eventAction)}&e_n=${encodeURIComponent(eventName)}&e_v=${encodeURIComponent(eventValue)}`
|
||||||
|
+((ua != null && ua.length > 0) ? ('&ua=' + StringUtils.URIEncode(ua)) : '') +
|
||||||
|
((referrer != null && referrer.length > 0) ? ('&urlref=' + StringUtils.URIEncode(referrer)) : '');
|
||||||
|
// console.log(trackingApiUrl)
|
||||||
|
console.log(url)
|
||||||
|
// return of(new Object()); // for testing
|
||||||
|
|
||||||
|
return this.http.get(url, {responseType: 'blob'});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private getUserAgent() {
|
private getUserAgent() {
|
||||||
if (typeof navigator !== 'undefined') {
|
if (typeof navigator !== 'undefined') {
|
||||||
return navigator.userAgent;
|
return navigator.userAgent;
|
||||||
|
|
Loading…
Reference in New Issue