From 8c9c63088a4b07a6aa168afb799045020ed3982a Mon Sep 17 00:00:00 2001 From: Christopher MANEU Date: Thu, 27 Jun 2024 14:41:14 +0200 Subject: [PATCH] Chore: Update Statslite endpoint --- build/templates/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/templates/index.html b/build/templates/index.html index ab10424..a0f54e1 100644 --- a/build/templates/index.html +++ b/build/templates/index.html @@ -18,7 +18,7 @@ })(window, document, "clarity", "script", "h5cwyu0xu4"); var sl=function(e){"use strict";class t{constructor(e,t){this.e=e,this.ts=new Date,this.p=t}}class i extends t{constructor(e,t=window.location.href,i=document.referrer){super("$pv",e),this.p=Object.assign(this.p,{url:t,referrer:i})}}return e.StatsliteClient=class{constructor(e,t,i=!0){this.customProperties={},this.globalProperties={},this.siteId=e,this.serviceEndpoint=t,this.globalProperties={sessionId:this.generateUuid()},i&&this.registerAutoEventTracking()}registerAutoEventTracking(){window.addEventListener("popstate",(()=>this.trackPageView())),window.addEventListener("hashchange",(()=>this.trackPageView()))}trackPageView(){let e=new i({},window.location.href,document.referrer);e=this.enrichEvent(e),this.sendEvent(e)}sendEvent(e){console.log("Sending event",e),fetch(`${this.serviceEndpoint}/${this.siteId}/collect`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}).then((e=>{e.ok})).catch((e=>{console.error("Network error:",e)}))}enrichEvent(e){Object.assign(e.p,this.customProperties),Object.assign(e.p,this.globalProperties);var t={browser:navigator.userAgent,screenWidth:window.screen.width,screenHeight:window.screen.height,language:navigator.language,timestamp:(new Date).toISOString(),ua:navigator.userAgent,viewportWidth:window.innerWidth,viewportHeight:window.innerHeight,eventId:this.generateUuid(),title:document.title};return Object.assign(e.p,t),e}generateUuid(){let e="";for(let t=0;t<36;t++)if(8===t||13===t||18===t||23===t)e+="-";else if(14===t)e+="4";else{e+="0123456789abcdef"[Math.floor(16*Math.random())]}return e}},e}({}); - var track = new sl.StatsliteClient("fabricnotes", "https://statslite-capture-ring1.trafficmanager.net", false); + var track = new sl.StatsliteClient("fabricnotes", "https://statslite-capture-r1-dccndrbdbtcmf0bu.b02.azurefd.net", false); track.trackPageView();