1function getDeviceType(){return/Mobi/.test(navigator.userAgent)?"Mobile":/Tablet/.test(navigator.userAgent)?"Tablet":"Desktop"}const analyticsEndpoint="https://analytics.thepublive.com/analytics/custom-analytics";function extractClientIdFromGaCookie(){const t=document.cookie.split("; ").find((t=>t.startsWith("_ga=")));if(t){return t.split("=")[1].split(".").slice(-2).join(".")}return null}function isFirstVisit(){return!localStorage.getItem("firstVisit")&&(localStorage.setItem("firstVisit","true"),!0)}function getSessionData(){const t=Date.now();let e=JSON.parse(localStorage.getItem("sessionData"))||{};return(!e.sessionTimestamp||t-e.sessionTimestamp>18e5)&&(e.sessionTimestamp=t,e.sct=(e.sct||0)+1),e.sid=Math.floor(e.sessionTimestamp/1e3),e.lastActivity=t,localStorage.setItem("sessionData",JSON.stringify(e)),e}function buildAnalyticsEndpoint(t,e){const n=window.performance.timing.loadEventEnd-window.performance.timing.navigationStart,s=performance.getEntriesByType("paint");let o="",i="";s.forEach((t=>{"first-contentful-paint"===t.name?o=Math.round(t.startTime):"largest-contentful-paint"===t.name&&(i=Math.round(t.startTime))}));const a=document.referrer,r=extractClientIdFromGaCookie(),c=getSessionData(),l=isFirstVisit(),p=1===c.sct,u=new URLSearchParams({event_name:t,canonicalUrl:document.location.href,canonicalHost:document.location.host,canonicalPath:document.location.pathname,title:document.title,firstContentfulPaint:o,largestContentfulPaint:i,contentLoadTime:n,source:a||"",cid:r,sid:c.sid,sct:c.sct,seg:p?1:0,_fv:l?1:0,_ss:p?1:0,...e});return`${analyticsEndpoint}?${u.toString()}`}function sendAnalyticsRequest(t){return fetch(t,{method:"POST"})}function trackAnalyticsEvent(t,e){const n=buildAnalyticsEndpoint(t,{...e,...{deviceType:getDeviceType(),userAgent:navigator.userAgent}});return console.log("Sending analytics event:",n),sendAnalyticsRequest(n).then((t=>{t.ok||console.error("Analytics event failed:",t.statusText)})).catch((t=>{console.error("Error sending analytics event:",t)}))}try{trackAnalyticsEvent("page_view",{pageTitle:postTitle,postCategory:postCategory,postAuthor:postAuthor,postID:postID,pubID:pubID,postLanguageCode:postLanguageCode,pubDomain:pubDomain,postMetaTitle:postMetaTitle,postMetaDescription:postMetaDescription,postFirstPublishedAt:postFirstPublishedAt,postCreatedBy:postCreatedBy,postLastPublishedAt:postLastPublishedAt,postContentType:postContentType,postBannerUrl:postBannerUrl,postPrimaryCategory:postPrimaryCategory})}catch(t){console.log("Error in analytics ",t)}
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.