1import{A as a,f as c,u as o,w as d,l as r}from"./index-Cva9ZJWk.js";const g=class extends a{constructor(){super(),this._id=config.googleAnalyticsMeasurementID,this._debug=c?.()?.debug==="true",this._auth=o(),this._createTracker(),this._auth=o(),this._loadScript(),window.addEventListener("BoltTrackScreenView",this._send.bind(this)),window.addEventListener("BoltTrackEvent",this._send.bind(this)),d(()=>this._auth.mergedState.value,this._identify.bind(this),{deep:!0,immediate:!0})}_createTracker(){window.dataLayer=window.dataLayer||[],window.gtag=function(){dataLayer.push(arguments)},window.gtag("js",new Date),window.gtag("config",this._id,{send_page_view:!1})}_loadScript(){var e=document.createElement("script");e.async=1,e.src="https://www.googletagmanager.com/gtag/js?id="+this._id,document.getElementsByTagName("head")[0].appendChild(e)}_identify(e,s){if(JSON.stringify(e?.userInfo)==="{}"&&s&&JSON.stringify(s?.userInfo)!=="{}"){window.gtag("set",{user_id:null}),window.gtag("set","user_properties",{});return}const i=this.getUserDimensions(),t=i?.id,n=this._renameDimensions(i);t&&(window.gtag("set",{user_id:t}),window.gtag("set","user_properties",n),r("debug","[GA4][USER]",`explicit identity ${t}`),r("debug","[GA4][USER]","user properties",n))}_sendDebugLogs(e,s){if(!this._debug)return;const i=s.page_location||window.location.href,t=this.determineScopes("KG",s.dimensions),n=`[GA4][${e.replace("BoltTrack","")}]`;r("debug",n,{url:i,payload:s,scopes:t})}_renameDimensions(e){const s=this.getCustomAnalyticsKeys(),i=Object.entries(e).map(([t,n])=>(t=t.replace("pugpig","KG"),s.includes(t)&&(t="KGU_"+t),[t,n]));return Object.fromEntries(i)}_modifyPayload(e){return e.param&&(e.dimensions.KGLabel=e.param),e.dimensions.KGURL&&(e.dimensions.page_location=e.dimensions.KGURL),e}async _send({type:e,detail:s}){s=JSON.parse(JSON.stringify(s)),s=this._modifyPayload(s),s.dimensions=this._renameDimensions(s.dimensions),e==="BoltTrackScreenView"&&this._sendScreenView(s),e==="BoltTrackEvent"&&this._sendEvent(s),this._sendDebugLogs(e,s)}_sendScreenView({dimensions:e}){window.gtag("event","page_view",e)}_sendEvent({category:e,event:s,dimensions:i}){window.gtag("event",s,{category:e,...i})}},_=new g;export{_ as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.