iBet uBet web content aggregator. Adding the entire web to your favor.
iBet uBet web content aggregator. Adding the entire web to your favor.



Link to original content: https://www.ft.com/__assets/hashed/page-kit/financial-times-n-tracking.57679d5f6ee2.bundle.js
(window.webpackJsonp=window.webpackJsonp||[]).push([["financial-times-n-tracking"],{d2988f39:function(t,e,n){"use strict";n.r(e),function(t){n.d(e,"SPOOR_API_INGEST_URL",(function(){return yt})),n.d(e,"broadcast",(function(){return g})),n.d(e,"init",(function(){return bt})),n.d(e,"trackers",(function(){return vt}));var i=n("6d73a2e3"),o=n("a4a69ef7"),r=n.n(o),a=n("939738f6"),c=n.n(a),s=n("2c27b745"),u=n("6fd7511d"),d=n("d70d095f"),l=n("b4722769");function f(t){const e=new RegExp(`(?:^| )${t}=([^;]+)`),n=document.cookie&&document.cookie.match(e);return n?n[1]:null}function p(){const t=navigator.connection||navigator.mozConnection||navigator.webkitConnection;return{layout:r.a.getCurrentLayout(),orientation:c.a.getOrientation(),connectionType:t?t.type:void 0,ft_session_publib:f("FTSession_PubLib")}}const m={appName:"app",contentId:"rootContentId",contentType:"rootContentType",conceptId:"rootConceptId",conceptType:"rootConceptType",segmentid:"marketing_segment_id",cpccampaign:"cpc_campaign",abTestState:"active_ammit_flags"};function h(t){const e={};return Object.keys(t).forEach(n=>{let i=t[n];"abTestState"===n&&(i=function(t){const e={};return t.split(",").map(t=>{const[n,i]=t.split(":");n&&i&&(e[n]=i)}),e}(i)),"contentId"===n&&(e.content={...e.content,uuid:i}),"contentType"===n&&(e.content={...e.content,asset_type:i}),e[m[n]||n]=i}),e}function g(t,e){let n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];const i=Element.prototype.isPrototypeOf(this)?this:document.body,o=new CustomEvent(t,{bubbles:n,cancelable:!0,detail:e});i.dispatchEvent(o)}var v="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0!==t?t:"undefined"!=typeof self?self:{};var y=function(t,e){return t(e={exports:{}},e.exports),e.exports}((function(t){var e=[],n=void 0===v?window:v,i=Math.pow(256,6),o=Math.pow(2,52),r=2*o,a=Math.random;function c(t){var e,n=t.length,i=this,o=0,r=i.i=i.j=0,a=i.S=[];for(n||(t=[n++]);o<256;)a[o]=o++;for(o=0;o<256;o++)a[o]=a[r=255&r+t[o%n]+(e=a[o])],a[r]=e;(i.g=function(t){for(var e,n=0,o=i.i,r=i.j,a=i.S;t--;)e=a[o=255&o+1],n=256*n+a[255&(a[o]=a[r=255&r+e])+(a[r]=e)];return i.i=o,i.j=r,n})(256)}function s(t,e){var n,i=[],o=(typeof t)[0];if(e&&"o"==o)for(n in t)try{i.push(s(t[n],e-1))}catch(t){}return i.length?i:"s"==o?t:t+"\0"}function u(t,e){for(var n,i=t+"",o=0;o=r;)t/=2,e/=2,n>>>=1;return(t+n)/e}},t.exports.resetGlobal=function(){Math.random=a},u(Math.random(),e)}));function b(t,e){const n=y(t)();return Math.round(100*n)<=e}y.resetGlobal;const T=()=>f("spoor-id"),w=["domInteractive","domComplete","timeToFirstByte","largestContentfulPaint","firstInputDelay","cumulativeLayoutShift","firstContentfulPaint","interactionToNextPaint"],E=t=>w.every(e=>"number"==typeof t[e]);var S,C,A,L,x=function(){return window.performance&&performance.getEntriesByType&&performance.getEntriesByType("navigation")[0]},k=function(t){if("loading"===document.readyState)return"loading";var e=x();if(e){if(t(e||100)-1)return n||o;if(n=n?o+">"+n:o,i.id)break;t=i.parentNode}}catch(t){}return n},P=-1,D=function(t){addEventListener("pageshow",(function(e){e.persisted&&(P=e.timeStamp,t(e))}),!0)},O=function(){var t=x();return t&&t.activationStart||0},R=function(t,e){var n=x(),i="navigate";return P>=0?i="back-forward-cache":n&&(document.prerendering||O()>0?i="prerender":document.wasDiscarded?i="restore":n.type&&(i=n.type.replace(/_/g,"-"))),{name:t,value:void 0===e?-1:e,rating:"good",delta:0,entries:[],id:"v3-".concat(Date.now(),"-").concat(Math.floor(8999999999999*Math.random())+1e12),navigationType:i}},_=function(t,e,n){try{if(PerformanceObserver.supportedEntryTypes.includes(t)){var i=new PerformanceObserver((function(t){Promise.resolve().then((function(){e(t.getEntries())}))}));return i.observe(Object.assign({type:t,buffered:!0},n||{})),i}}catch(t){}},F=function(t,e,n,i){var o,r;return function(a){e.value>=0&&(a||i)&&((r=e.value-(o||0))||void 0===o)&&(o=e.value,e.delta=r,e.rating=function(t,e){return t>e[1]?"poor":t>e[0]?"needs-improvement":"good"}(e.value,n),t(e))}},j=function(t){requestAnimationFrame((function(){return requestAnimationFrame((function(){return t()}))}))},N=function(t){var e=function(e){"pagehide"!==e.type&&"hidden"!==document.visibilityState||t(e)};addEventListener("visibilitychange",e,!0),addEventListener("pagehide",e,!0)},B=function(t){var e=!1;return function(n){e||(t(n),e=!0)}},U=-1,V=function(){return"hidden"!==document.visibilityState||document.prerendering?1/0:0},q=function(t){"hidden"===document.visibilityState&&U>-1&&(U="visibilitychange"===t.type?t.timeStamp:0,z())},H=function(){addEventListener("visibilitychange",q,!0),addEventListener("prerenderingchange",q,!0)},z=function(){removeEventListener("visibilitychange",q,!0),removeEventListener("prerenderingchange",q,!0)},G=function(){return U<0&&(U=V(),H(),D((function(){setTimeout((function(){U=V(),H()}),0)}))),{get firstHiddenTime(){return U}}},J=function(t){document.prerendering?addEventListener("prerenderingchange",(function(){return t()}),!0):t()},W=[1800,3e3],$=[.1,.25],K=function(t,e){!function(t,e){e=e||{},function(t,e){e=e||{},J((function(){var n,i=G(),o=R("FCP"),r=_("paint",(function(t){t.forEach((function(t){"first-contentful-paint"===t.name&&(r.disconnect(),t.startTimei.value&&(i.value=o,i.entries=r,n())},c=_("layout-shift",a);c&&(n=F(t,i,$,e.reportAllChanges),N((function(){a(c.takeRecords()),n(!0)})),D((function(){o=0,i=R("CLS",0),n=F(t,i,$,e.reportAllChanges),j((function(){return n()}))})),setTimeout(n,0))})))}((function(e){!function(t){if(t.entries.length){var e=t.entries.reduce((function(t,e){return t&&t.value>e.value?t:e}));if(e&&e.sources&&e.sources.length){var n=(i=e.sources).find((function(t){return t.node&&1===t.node.nodeType}))||i[0];if(n)return void(t.attribution={largestShiftTarget:M(n.node),largestShiftTime:e.startTime,largestShiftValue:e.value,largestShiftSource:n,largestShiftEntry:e,loadState:k(e.startTime)})}}var i;t.attribution={}}(e),t(e)}),e)},Q={passive:!0,capture:!0},X=new Date,Y=function(t,e){S||(S=e,C=t,A=new Date,et(removeEventListener),Z())},Z=function(){if(C>=0&&C1e12?new Date:performance.now())-t.timeStamp;"pointerdown"==t.type?function(t,e){var n=function(){Y(t,e),o()},i=function(){o()},o=function(){removeEventListener("pointerup",n,Q),removeEventListener("pointercancel",i,Q)};addEventListener("pointerup",n,Q),addEventListener("pointercancel",i,Q)}(e,t):Y(e,t)}},et=function(t){["mousedown","keydown","touchstart","pointerdown"].forEach((function(e){return t(e,tt,Q)}))},nt=[100,300],it=function(t,e){e=e||{},J((function(){var n,i=G(),o=R("FID"),r=function(t){t.startTime"LCP"===t.name?{name:t.name,lcp:t.value,lcpDelta:t.delta,element:t.attribution.largestShiftTarget}:"FID"===t.name?{name:t.name,fid:t.value,fidDelta:t.delta,element:t.attribution.eventTarget}:"CLS"===t.name?{name:t.name,cls:t.value,clsDelta:t.delta,element:t.attribution.largestShiftTarget}:void 0,ut=[25,50,75,100],dt={onScroll:()=>{},target:"body",debug:!1};class lt{constructor(t){this.options={...dt,...t},this.init()}init(){const t=document.querySelector(this.options.target);t&&"IntersectionObserver"in window&&(this.observer=new IntersectionObserver(this.handleIntersection.bind(this)),t.style.position="relative",ut.forEach(e=>{const n=document.createElement("div");n.className="n-tracking-scroll-depth-marker",n.style.position="absolute",n.style.top=e+"%",n.style.bottom="0",n.style.width="100%",n.style.zIndex="-1",n.setAttribute("data-scroll-depth",e),t.appendChild(n),this.observer.observe(n)}))}handleIntersection(t){t.forEach(t=>{if(t.isIntersecting||t.intersectionRatio>0){const e=t.target,n=e.getAttribute("data-scroll-depth");this.options.onScroll(n),this.options.debug&&console.log("ScrollDepth",{marker:n}),e.parentNode&&e.parentNode.removeChild(e),this.observer.unobserve(e)}})}}const ft=["load","click","focus","scroll","mousemove","touchstart","touchend","touchcancel","touchleave"],pt=["blur"],mt=["beforeunload","unload","pagehide"],ht={onExit:()=>{},debug:!1};class gt{constructor(t){this.options={...ht,...t},this.totalAttentionTime=0,this.hasExited=!1,this.init()}init(){ft.forEach(t=>{window.addEventListener(t,this.startAttention.bind(this))}),pt.forEach(t=>{window.addEventListener(t,this.endAttention.bind(this))}),mt.forEach(t=>{window.addEventListener(t,this.handleExit.bind(this))}),document.addEventListener("visibilitychange",this.handleVisibilityChange.bind(this));document.querySelectorAll("video").forEach(t=>{t.addEventListener("playing",this.startConstantAttention.bind(this)),t.addEventListener("pause",this.endConstantAttention.bind(this)),t.addEventListener("ended",this.endConstantAttention.bind(this))})}startAttention(t){clearTimeout(this.attentionTimeout),this.startAttentionTime||(this.startAttentionTime=Date.now()),this.attentionTimeout=setTimeout(this.endAttention.bind(this,{type:"timeout"}),15e3),this.options.debug&&console.log("AttentionTime start",{event:t.type})}endAttention(t){this.startAttentionTime&&(clearTimeout(this.attentionTimeout),this.totalAttentionTime=this.getAttentionTime(),this.startAttentionTime=null),this.options.debug&&console.log("AttentionTime end",{event:t.type,time:this.totalAttentionTime})}startConstantAttention(){this.constantAttentionInterval=setInterval(this.startAttention.bind(this),15e3)}endConstantAttention(t){this.endAttention(t),clearInterval(this.constantAttentionInterval)}getAttentionTime(){let t=0;return this.startAttentionTime&&(t=Math.round((Date.now()-this.startAttentionTime)/1e3)),this.totalAttentionTime+t}handleVisibilityChange(t){"hidden"===document.visibilityState?this.endAttention(t):this.startAttention(t)}handleExit(t){this.hasExited||(this.endAttention(t),this.options.debug&&console.log("AttentionTime",{event:t.type,time:this.totalAttentionTime}),this.options.onExit(this.totalAttentionTime),this.hasExited=!0)}}var vt=Object.freeze({__proto__:null,realUserMonitoringForPerformance:function(){let{sampleRate:t}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!1 in window)return;const e=T();if(t=Number.isFinite(t)&&t<=100&&t>=0?t:10,!b(e,t))return;const n=performance.getEntriesByType("navigation")&&performance.getEntriesByType("navigation")[0];if(!n||"navigate"!==n.type)return;const i={};l.default.complete.then(()=>{i.domInteractive=Math.round(n.domInteractive),i.domComplete=Math.round(n.domComplete)});let o=!1;const r=t=>{if(o)return;const e=t.name.toLowerCase(),n=t.value;"fid"===e?i.firstInputDelay=Math.round(n):"lcp"===e?i.largestContentfulPaint=Math.round(n):"ttfb"===e?i.timeToFirstByte=Math.round(n):"fcp"===e?i.firstContentfulPaint=Math.round(n):"cls"===e?i.cumulativeLayoutShift=Number(n.toFixed(4)):"inp"===e&&(i.interactionToNextPaint=Math.round(n)),i.url=window.document.location.href||null,E(i)&&(console.log({performanceMetrics:i}),g("oTracking.event",{action:"performance",category:"page",...i}),o=!0)};Object(d.a)(r,{reportAllChanges:!0}),Object(d.b)(r),Object(d.c)(r),Object(d.e)(r),Object(d.f)(r),Object(d.d)(r)},realUserMonitoringWithAttribution:function(){let{sampleRate:t}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const e=t=>{g("oTracking.event",{action:"performance-attribution",category:"page",...st(t)})};if(!1 in window)return;const n=T(),i=t||1;if(!b(n,i))return;const o=performance.getEntriesByType("navigation")&&performance.getEntriesByType("navigation")[0];o&&"navigate"===o.type&&(K(e,{reportAllChanges:!0}),ot(e),ct(e))},pageAttention:function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const e=t=>{g("oTracking.event",{category:"page",action:"interaction",context:{attention:{total:t}}})},n=new gt({...t,onExit:e}),i=t=>{g("oTracking.event",{category:"page",action:"scrolldepth",meta:{percentagesViewed:t,attention:n.getAttentionTime()}})};new lt({...t,onScroll:i})},textCopying:()=>{document.addEventListener("copy",t=>{const e={nodeName:t.target.nodeName.toLowerCase()};if(window.getSelection){const t=window.getSelection().toString().trim();e.characters=t.length,e.words=t.split(/\s+/).length,e.selection=(t=>{if(t.length>100){const e=100-" … ".length,n=Math.floor(e/2),i=Math.ceil(e/2);return t.substr(0,n)+" … "+t.substr(-1*i)}return t})(t)}g("oTracking.event",{action:"copy",category:"text",context:e})})}});const yt="https://spoor-api.ft.com/ingest";function bt(t){let{appContext:e,extraContext:n,pageViewContext:o}=t;const r=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:window.location.search;const e={},n=["segmentid","cpccampaign"],i=new URLSearchParams(t);return n.forEach(t=>{const n=i.get(t);n&&(e[t]=n)}),e}(),a={server:yt,context:h({...r,...e,...n}),user:p(),useSendBeacon:!0};if(i.default.init(a),window===window.top||"errors-next.ft.com"===window.location.hostname){const t={...function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:window.location.search;const e=new URLSearchParams(t),n=e.get("nextErrorStatus"),i=e.get("nextErrorReason");if(n||i)return{errorStatus:n,errorReason:i,url:window.parent.location.toString(),referrer:window.parent.document.referrer}}(),...o};(async function(){return{...(await Object(u.a)()).isAllowed(),usprivacy:Object(s.getUsPrivacyForTracking)()}})().then(e=>{i.default.page({...t,consents:e})}).catch(e=>{console.warn("Could not get consent data",e),i.default.page(t)})}return i.default.click.init("cta"),window.oTracking?console.warn("An oTracking instance already exists on window, skipping",{currentInstance:window.oTracking,ourInstance:i.default}):window.oTracking=i.default,i.default}}.call(this,n("fcdffa92"))}}]); //# sourceMappingURL=financial-times-n-tracking.57679d5f6ee2.bundle.js.map