https://www.bowflex.com/cdn/shop/t/6/assets/bfx-client-telemetry.js?v=129217995134214870531789763291
1const initClientTelemetry=()=>{const DATALAYER_EVENT="bfx_telemetry",dataLayerEnabled=()=>window.__bfxTelemetryDataLayer===!0||!1,mouseflowEnabled=()=>window.__bfxTelemetryMouseflow===!0||!1,datadogEnabled=()=>window.__bfxTelemetryDatadog===!0||!1,analyticsAllowed=()=>{try{const api=window.Shopify&&window.Shopify.customerPrivacy;if(api&&typeof api.analyticsProcessingAllowed=="function")return api.analyticsProcessingAllowed()}catch{}return null},MOUSEFLOW_TAG="bfx-telemetry",OBSERVATION_TYPES=new Set(["long_task"]),MAX_OBSERVATION_REPORTS=5,MAX_CONSECUTIVE_REFUSALS=20,REFUSAL_PROBE_EVERY=50,LONG_TASK_MS=200,HEAP_FAST_MS=6e4,HEAP_FAST_SAMPLES=30,HEAP_SLOW_MS=6e5,HEAP_MAX_SAMPLES=60,HEAP_REPORT_RATIO=.7,APP_SEGMENTS=new Set(["cart","search","recommendations","products","collections"]),debug=(()=>{try{if(localStorage.getItem("bfx-telemetry-debug")==="1")return!0}catch{}return new URLSearchParams(location.search).get("bfx_telemetry_debug")==="1"})();let reported=0,observationsReported=0,consecutiveRefusals=0,sinceProbe=0;const egressedKeys=new Set,printedKeys=new Set,controller=new AbortController,{signal}=controller,observers=[],timerStops=[],asText=value=>{try{const t=typeof value;return t==="string"?value:t==="number"||t==="boolean"?String(value):""}catch{return""}},fieldOf=(holder,key)=>{try{return asText(holder[key])}catch{return""}},trimStack=value=>String(value??"").slice(0,4e3),EMAIL=/[\w.+-]+@[\w-]+\.[\w.-]+/g,URL_IN_TEXT=/\bhttps?:\/\/[^\s'"()<>]+/g,TOKEN=/\b[A-Za-z0-9_-]{20,}\b/g,LONG_DIGITS=/\d{7,}/g,redact=value=>String(value??"").replace(EMAIL,"[email]").replace(URL_IN_TEXT,m=>{try{const u=new URL(m);return`${u.origin}${u.pathname}`}catch{return m.split("?")[0]}}).replace(TOKEN,"[token]").replace(LONG_DIGITS,"[number]"),safe=value=>redact(value).slice(0,300),safeDebug=value=>redact(value).slice(0,4e3),FREE_TEXT_TYPES=new Set(["js_error","promise_rejection"]),ERROR_NAMES=new Set(["Error","EvalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError","AggregateError","DOMException","AbortError","NotAllowedError","NetworkError","SecurityError","TimeoutError","QuotaExceededError"]),errorKind=(name,message)=>{if(name&&ERROR_NAMES.has(name))return name;const leading=String(message??"").match(/^\s*([A-Za-z]+)\b/);return leading&&ERROR_NAMES.has(leading[1])?leading[1]:"unknown"},groupingId=(type,detail,extra)=>{if(!FREE_TEXT_TYPES.has(type))return safe(detail);const where=extra.telemetry_source?`${extra.telemetry_source}:${extra.telemetry_line||0}`:"no-source";return safe(`${errorKind(extra.errorName,detail)} @ ${where}`)},isAccountPath=pathname=>{const segments=pathname.split("/").filter(Boolean);return segments[0]==="account"||segments[1]==="account"},SAFE_PATHNAME=/^[A-Za-z0-9/._~-]*$/,RESOURCE_TAGS=new Set(["script","link","img","iframe","video","audio","source","track","embed","object","shopify-account"]),safeTag=tag=>{const lower=String(tag??"").toLowerCase();return RESOURCE_TAGS.has(lower)?lower:"custom-element"},KNOWN_ROUTES=new Set(["cdn","collections","products","pages","blogs","cart","search","policies","recommendations"]),ROUTE_FAMILIES=new Set([...KNOWN_ROUTES,"account","checkout","apps"]),stripLocaleRoot=pathname=>{const path=String(pathname??""),lower=path.toLowerCase(),shopify=window.Shopify||{},locale=String(shopify.locale||"").toLowerCase(),candidates=[];locale&&locale!=="en"&&candidates.push(`/${locale}`);const root=shopify.routes&&shopify.routes.root||"/";root!=="/"&&candidates.push(root.replace(/\/$/,""));for(const prefix of candidates)if(lower===prefix||lower.startsWith(`${prefix}/`))return path.slice(prefix.length)||"/";return path},REQUEST_INITIATORS=new Set(["fetch","xmlhttprequest"]),APP_ENDPOINTS=new Set(["/cart.js","/cart/add.js","/cart/update.js","/cart/change.js","/cart/clear.js","/cart/shipping_rates.json","/cart/prepare_shipping_rates.json","/cart/async_shipping_rates.json","/search/suggest","/search/suggest.json","/recommendations/products","/recommendations/products.json"]),INITIATOR_TYPES=new Set(["fetch","xmlhttprequest","script","link","img","css","beacon","iframe","video","audio","track","embed","object","navigation","other"]),LONG_TASK_NAMES=new Set(["self","same-origin","same-origin-ancestor","same-origin-descendant","cross-origin-ancestor","cross-origin-descendant","cross-origin-unreachable","multiple-contexts","unknown"]),safeEnum=(value,allowed,fallback)=>{const lower=String(value??"").toLowerCase();return allowed.has(lower)?lower:fallback},CDN_FIXED_PREFIXES=["/cdn/shop/t/","/cdn/shopifycloud/"],pageRoute=pathname=>
1{const[first]=stripLocaleRoot(pathname).split("/").filter(Boolean);if(!first)return"home";const family=first.toLowerCase();return ROUTE_FAMILIES.has(family)?family:"other"},scrubUrl=raw=>{if(!raw)return"";try{const url=new URL(raw,location.href);if(url.protocol!=="http:"&&url.protocol!=="https:")return"(non-http source)";if(isAccountPath(url.pathname)||!SAFE_PATHNAME.test(url.pathname)||url.origin!==location.origin)return url.origin;const localPath=stripLocaleRoot(url.pathname),[first]=localPath.split("/").filter(Boolean);return first?first.toLowerCase()==="cdn"?CDN_FIXED_PREFIXES.some(prefix=>localPath.startsWith(prefix))?`${url.origin}${url.pathname}`:`${url.origin}/cdn`:APP_ENDPOINTS.has(localPath.toLowerCase())?`${url.origin}${url.pathname}`:`${url.origin}/${pageRoute(url.pathname)}`:url.origin}catch{return"(unparseable source)"}},describeElement=(tag,resource)=>{const safe_tag=safeTag(tag);return resource?`${safe_tag}: ${scrubUrl(resource)}`:safe_tag},toDataLayer=payload=>{try{return window.dataLayer=window.dataLayer||[],window.dataLayer.push({event:DATALAYER_EVENT,...payload}),!0}catch(error){return debug&&console.warn("[bfx-telemetry] the dataLayer sink threw; treated as a refusal",error),!1}},toMouseflow=payload=>{if(!mouseflowEnabled()||!Array.isArray(window._mfq))return!1;let delivered=!1;try{window._mfq.push(["tag",`${MOUSEFLOW_TAG}-${payload.telemetry_type}`]),delivered=!0,window._mfq.push(["setVariable","bfxTelemetryDetail",payload.telemetry_detail])}catch(error){debug&&console.warn(`[bfx-telemetry] the Mouseflow sink threw (tag ${delivered?"delivered":"not delivered"})`,error)}return delivered},toDatadog=payload=>{try{const status=OBSERVATION_TYPES.has(payload.telemetry_type)?"warn":"error";return window.DD_LOGS.logger.log(payload.telemetry_type,payload,status),!0}catch(error){return debug&&console.warn("[bfx-telemetry] the Datadog sink threw; treated as a refusal",error),!1}},DONE={egressed:!1,retriable:!1},LATER={egressed:!1,retriable:!0},dataLayerReady=()=>dataLayerEnabled()&&analyticsAllowed()===!0,mouseflowReady=()=>mouseflowEnabled()&&Array.isArray(window._mfq),datadogReady=()=>datadogEnabled()&&analyticsAllowed()===!0&&!!(window.DD_LOGS&&window.DD_LOGS.logger&&typeof window.DD_LOGS.logger.log=="function"),anySinkReady=()=>dataLayerReady()||mouseflowReady()||datadogReady()||debug,report=(type,detail,extra={})=>
1{if(analyticsAllowed()===!1)return DONE;const dataLayerAvailable=dataLayerReady(),mouseflowAvailable=mouseflowReady(),datadogAvailable=datadogReady();if(!dataLayerAvailable&&!mouseflowAvailable&&!datadogAvailable&&!debug)return LATER;const isObservation=OBSERVATION_TYPES.has(type),withinBudget=reported<25&&!(isObservation&&observationsReported>=MAX_OBSERVATION_REPORTS);if(!withinBudget&&!debug)return DONE;const emitted=groupingId(type,detail,extra),key=`${type}|${emitted}`;if(egressedKeys.has(key))return DONE;let breakerOpen=!1;if(consecutiveRefusals>=MAX_CONSECUTIVE_REFUSALS&&(sinceProbe+=1,sinceProbe<REFUSAL_PROBE_EVERY?breakerOpen=!0:sinceProbe=0),breakerOpen&&!debug)return LATER;const redactedExtra={};for(const[k,v]of Object.entries(extra))k==="telemetry_stack"||k==="errorName"||(redactedExtra[k]=typeof v=="string"?safe(v):v);const payload={telemetry_type:type,telemetry_detail:emitted,telemetry_page:pageRoute(location.pathname),telemetry_viewport:`${window.innerWidth}x${window.innerHeight}`,...redactedExtra};debug&&!printedKeys.has(key)&&(printedKeys.add(key),console.warn(`[bfx-telemetry] ${type}`,{...payload,debug_detail:safeDebug(detail),debug_stack:safeDebug(extra.telemetry_stack||"")}));const canEgress=withinBudget&&!breakerOpen,acceptedByDataLayer=canEgress&&dataLayerAvailable?toDataLayer(payload):!1,acceptedByMouseflow=canEgress&&mouseflowAvailable?toMouseflow(payload):!1,acceptedByDatadog=canEgress&&datadogAvailable?toDatadog(payload):!1,consumed=acceptedByDataLayer||acceptedByMouseflow||acceptedByDatadog||debug,egressed=acceptedByDataLayer||acceptedByMouseflow||acceptedByDatadog;return egressed?(consecutiveRefusals=0,sinceProbe=0):canEgress&&(dataLayerAvailable||mouseflowAvailable||datadogAvailable)&&(consecutiveRefusals+=1),consumed?(egressed&&(egressedKeys.add(key),reported+=1,isObservation&&(observationsReported+=1)),egressed?{egressed:!0,retriable:!1}:withinBudget?LATER:DONE):(debug&&console.warn("[bfx-telemetry] nothing consumed the report",type),LATER)},reportBufferedEntry=entry=>entry.type==="resource_error"?report("resource_error",describeElement(entry.tag,entry.resource),{telemetry_resource_tag:safeTag(entry.tag)}):entry.type==="js_error"?report("js_error",entry.message,{errorName:entry.name||"",telemetry_source:scrubUrl(entry.source),telemetry_line:entry.line,telemetry_stack:trimStack(entry.stack)}):entry.type==="promise_rejection"?report("promise_rejection",entry.message,{errorName:entry.name||"",telemetry_stack:trimStack(entry.stack)}):DONE,drainBootQueue=()=>{const boot=window.__bfxTelemetry;if(!boot||!Array.isArray(boot.queue))return;const unsent=boot.queue.filter(entry=>reportBufferedEntry(entry).retriable);boot.queue.length=0;for(const entry of unsent)boot.queue.push(entry);boot.ready=!0},MAX_PENDING=50,pending=[],exposePendingCount=()=>{const boot=window.__bfxTelemetry;if(boot)try{Object.defineProperty(boot,"pendingCount",{get:()=>pending.length,configurable:!0}),Object.defineProperty(boot,"pendingBytes",{get:()=>pending.reduce((total,item)=>{let bytes=String(item.detail||"").length;for(const value of Object.values(item.extra||{}))typeof value=="string"&&(bytes+=value.length);return total+bytes},0),configurable:!0})}catch{}},reportLive=(type,detail,extra)=>{const outcome=report(type,detail,extra);if(!outcome.retriable||pending.length>=MAX_PENDING)return outcome;const key=`${type}|${groupingId(type,detail,extra)}`;if(pending.some(item=>item.key===key))return outcome;const clampedExtra={};for(const[k,v]of Object.entries(extra||{}))clampedExtra[k]=typeof v=="string"?v.slice(0,4e3):v;return pending.push({key,type,detail:asText(detail).slice(0,4e3),extra:clampedExtra}),outcome},retryBufferedEntries=()=>{if(!anySinkReady())return;const boot=window.__bfxTelemetry;if(!boot||!Array.isArray(boot.queue)||boot.queue.length===0)return;const unsent=boot.queue.filter(entry=>reportBufferedEntry(entry).retriable);boot.queue.length=0;for(const entry of unsent)boot.queue.push(entry)},retryEverything=()=>{if(!anySinkReady()||(retryBufferedEntries(),pending.length===0))return;const stillPending=pending.filter(item=>
1report(item.type,item.detail,item.extra).retriable);pending.length=0;for(const item of stillPending)pending.push(item)},watchVisibility=()=>{document.addEventListener("visibilitychange",()=>retryEverything(),{signal})},watchLiveErrors=()=>{window.addEventListener("error",event=>{retryBufferedEntries();const el=event.target;if(el&&el!==window&&el.tagName){const tag=el.tagName.toLowerCase(),resource=fieldOf(el,"currentSrc")||fieldOf(el,"src")||fieldOf(el,"href")||fieldOf(el,"data");reportLive("resource_error",describeElement(tag,resource),{telemetry_resource_tag:safeTag(tag)});return}reportLive("js_error",asText(event.message)||"unknown",{errorName:fieldOf(event.error,"name"),telemetry_source:scrubUrl(asText(event.filename)),telemetry_line:event.lineno||0,telemetry_stack:trimStack(fieldOf(event.error,"stack"))})},{capture:!0,signal}),window.addEventListener("unhandledrejection",event=>{retryBufferedEntries();const reason=event.reason;reportLive("promise_rejection",fieldOf(reason,"message")||asText(reason)||"unknown",{errorName:fieldOf(reason,"name"),telemetry_stack:trimStack(fieldOf(reason,"stack"))})},{signal})},isAppRequest=url=>{try{const parsed=new URL(url,location.href);if(parsed.origin!==location.origin)return!1;const[segment]=stripLocaleRoot(parsed.pathname).split("/").filter(Boolean);return segment?APP_SEGMENTS.has(segment.replace(/\.(js|json)$/,"")):!1}catch{return!1}},observe=(type,handler,options={})=>{if(typeof PerformanceObserver=="function")try{const observer=new PerformanceObserver((list,_observer,options2)=>{const dropped=options2&&typeof options2.droppedEntriesCount=="number"?options2.droppedEntriesCount:0;dropped>0&&debug&&console.warn(`[bfx-telemetry] ${dropped} buffered "${type}" entries were evicted before this observer attached`);for(const entry of list.getEntries())handler(entry)});observer.observe({type,buffered:!0,...options}),observers.push(observer)}catch{debug&&console.warn(`[bfx-telemetry] no support for PerformanceObserver type "${type}"`)}},watchRequests=()=>{observe("resource",entry=>{const status=entry.responseStatus;status!=null&&(status!==0&&status<400||REQUEST_INITIATORS.has(String(entry.initiatorType||"").toLowerCase())&&isAppRequest(entry.name)&&reportLive("request_failed",`${status===0?"network-error":status} ${scrubUrl(entry.name)}`,{telemetry_status:status,telemetry_initiator:safeEnum(entry.initiatorType,INITIATOR_TYPES,"other")}))})},watchPerformance=()=>{observe("longtask",entry=>{entry.duration<LONG_TASK_MS||report("long_task",`${Math.round(entry.duration/50)*50}ms ${safeEnum(entry.name,LONG_TASK_NAMES,"unknown")}`,{telemetry_duration_ms:Math.round(entry.duration)})})},watchHeap=()=>{if(!performance.memory)return;let samples=0,timer=0;const stopSampling=()=>window.clearInterval(timer);timerStops.push(stopSampling);const sample=()=>{samples+=1,retryEverything();const{usedJSHeapSize,jsHeapSizeLimit}=performance.memory,ratio=jsHeapSizeLimit?usedJSHeapSize/jsHeapSizeLimit:0;if(ratio>=HEAP_REPORT_RATIO&&report("heap_pressure",`${Math.round(ratio*100)}% of limit`,{telemetry_heap_used_mb:Math.round(usedJSHeapSize/1048576),telemetry_heap_limit_mb:Math.round(jsHeapSizeLimit/1048576),telemetry_minutes_open:Math.round(performance.now()/6e4),telemetry_was_hidden:document.hidden?"yes":"no"}).egressed){stopSampling();return}if(samples>=HEAP_MAX_SAMPLES){stopSampling();return}samples===HEAP_FAST_SAMPLES&&(stopSampling(),timer=window.setInterval(sample,HEAP_SLOW_MS))};timer=window.setInterval(sample,HEAP_FAST_MS)},teardown=()=>{for(const observer of observers)try{observer.disconnect()}catch{}observers.length=0;for(const stop of timerStops)try{stop()}catch{}timerStops.length=0,controller.abort()};window.addEventListener("pagehide",event=>{event.persisted||teardown()},{signal}),watchLiveErrors(),drainBootQueue(),watchRequests(),watchPerformance(),watchHeap(),watchVisibility(),exposePendingCount(),debug&&console.warn("[bfx-telemetry] active \u2014 debug channel on")};initClientTelemetry(); 2//# sourceMappingURL=/cdn/shop/t/6/assets/bfx-client-telemetry.js.map?v=129217995134214870531789763291
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.