PageSourceSearch

https://mojwhf.sprucehealth.com/analytics/measure-v1.js

js sprucehealth.com collected 2026-09-24 10:10:54 UTC 41,787 bytes, 131 lines download raw bytes

1(function(window,document,undefined){'use strict';var scriptTag=document.currentScript||document.querySelector('script[src*="measure-v1.js"],script[src*="/analytics/v1/measure.js"]');var globalName=scriptTag?scriptTag.getAttribute('data-global-name')||'ca':'ca';var apiKey=scriptTag?(scriptTag.getAttribute('data-api-key')||(scriptTag.src.indexOf('?')>-1?new URLSearchParams(scriptTag.src.split('?')[1]).get('key'):null)):null;var isDebugMode=window.localStorage&&localStorage.getItem('_ca_debug')==='true';var baseUrl='https://api.conceptualhq.com';if(isDebugMode&&window.location.hostname.includes('.test')){baseUrl=window.location.protocol+'//'+window.location.hostname;console.log('[CA Debug] Using local endpoints: '+baseUrl)}
2var config={apiKey:apiKey,trackEndpoint:baseUrl+'/api/v1/track',identifyEndpoint:baseUrl+'/api/v1/identify',debug:isDebugMode,trackPageViews:!0,trackUnload:!0,respectDNT:!1,sessionTimeout:30*60*1000,customDomain:null,autoFormLeadDetectionEnabled:!1,autoFormLeadDetectedEventName:'lead_detected',autoFormLeadDedupTtlMs:10*60*1000,autoFormLeadRecentDedupTtlMs:30*1000,apiVersion:'v1',isDebugMode:isDebugMode};var injectedConfig=window.__CA_CONFIG||{};for(var injectedKey in injectedConfig){if(Object.prototype.hasOwnProperty.call(injectedConfig,injectedKey)&&Object.prototype.hasOwnProperty.call(config,injectedKey)){config[injectedKey]=injectedConfig[injectedKey]}}
3var BrowserCapabilities={collect:function(){var data={};try{data.screen={width:window.screen.width,height:window.screen.height,availWidth:window.screen.availWidth,availHeight:window.screen.availHeight,colorDepth:window.screen.colorDepth,pixelDepth:window.screen.pixelDepth,devicePixelRatio:window.devicePixelRatio||1};data.browser={language:navigator.language||navigator.userLanguage,languages:navigator.languages||[],userAgent:navigator.userAgent,platform:navigator.platform,vendor:navigator.vendor||'',cookieEnabled:navigator.cookieEnabled,doNotTrack:navigator.doNotTrack,hardwareConcurrency:navigator.hardwareConcurrency||null,deviceMemory:navigator.deviceMemory||null,maxTouchPoints:navigator.maxTouchPoints||0};data.timezone={offset:new Date().getTimezoneOffset(),timezone:Intl.DateTimeFormat().resolvedOptions().timeZone};data.storage={localStorage:this.testStorage('localStorage'),sessionStorage:this.testStorage('sessionStorage'),indexedDB:!!window.indexedDB};data.webgl=this.getWebGLInfo();data.canvas=this.getCanvasData();data.audio=this.getAudioContext();data.plugins=this.getPlugins();data.fonts=this.getCommonFonts()}catch(e){if(config.debug)console.error('Browser data collection error:',e);}
4return data},testStorage:function(type){try{var storage=window[type];var x='__storage_test__';storage.setItem(x,x);storage.removeItem(x);return!0}catch(e){return!1}},getWebGLInfo:function(){try{var canvas=document.createElement('canvas');var gl=canvas.getContext('webgl')||canvas.getContext('experimental-webgl');if(!gl)return null;var debugInfo=gl.getExtension('WEBGL_debug_renderer_info');if(!debugInfo)return null;return{vendor:gl.getParameter(debugInfo.UNMASKED_VENDOR_WEBGL),renderer:gl.getParameter(debugInfo.UNMASKED_RENDERER_WEBGL)}}catch(e){return null}},getCanvasData:function(){try{var canvas=document.createElement('canvas');canvas.width=280;canvas.height=60;var ctx=canvas.getContext('2d');ctx.fillStyle='#f60';ctx.fillRect(125,1,62,20);ctx.fillStyle='#069';ctx.font='11pt no-real-font-123';ctx.fillText('Conceptual Analytics 🚀 📊',2,15);ctx.fillStyle='rgba(102, 204, 0, 0.7)';ctx.font='18pt Arial';ctx.fillText('Analytics',4,45);return canvas.toDataURL().substring(0,100)}catch(e){return null}},getAudioContext:function(){return null},getPlugins:function(){var plugins=[];try{for(var i=0;i<navigator.plugins.length&&i<10;i++){plugins.push(navigator.plugins[i].name)}}catch(e){}
5return plugins},getCommonFonts:function(){var fonts=['Arial','Verdana','Times New Roman','Courier New','Georgia'];var available=[];return fonts}};var IPManager={memoryCache:null,memoryCacheTime:null,sessionKey:'_ca_client_ip',sessionTimeKey:'_ca_client_ip_time',ttlMemory:5*60*1000,ttlSession:30*60*1000,getIP:function(){if(this.memoryCache&&this.memoryCacheTime&&(Date.now()-this.memoryCacheTime<this.ttlMemory)){if(config.debug)console.log('IP from memory cache:',this.memoryCache);return Promise.resolve(this.memoryCache)}
6try{var sessionIP=sessionStorage.getItem(this.sessionKey);var sessionTime=sessionStorage.getItem(this.sessionTimeKey);if(sessionIP&&sessionTime&&(Date.now()-parseInt(sessionTime)<this.ttlSession)){this.memoryCache=sessionIP;this.memoryCacheTime=parseInt(sessionTime);if(config.debug)console.log('IP from session storage:',sessionIP);return Promise.resolve(sessionIP)}}catch(e){if(config.debug)console.warn('SessionStorage not available:',e);}
7return this.fetchIP()},fetchIP:function(){var self=this;var controller=typeof AbortController!=='undefined'?new AbortController():null;var timeoutId=null;if(controller){timeoutId=setTimeout(function(){controller.abort()},3000)}
8return fetch('https://ip.conceptualhq.com/',{method:'GET',mode:'cors',cache:'no-cache',signal:controller?controller.signal:undefined}).then(function(response){if(timeoutId)clearTimeout(timeoutId);if(!response.ok){throw new Error('IP service returned '+response.status)}
9return response.text()}).then(function(ip){ip=ip.trim();if(!self.isValidIP(ip)){throw new Error('Invalid IP format received: '+ip)}
10self.memoryCache=ip;self.memoryCacheTime=Date.now();try{sessionStorage.setItem(self.sessionKey,ip);sessionStorage.setItem(self.sessionTimeKey,self.memoryCacheTime.toString())}catch(e){if(config.debug)console.warn('Failed to store IP in session:',e);}
11if(config.debug)console.log('Fetched fresh IP:',ip);return ip}).catch(function(error){if(config.debug)console.warn('Failed to fetch client IP:',error.message);return null})},isValidIP:function(ip){var ipv4Regex=/^(\d{1,3}\.){3}\d{1,3}$/;var ipv6Regex=/^([0-9a-fA-F]{0,4}:){2,7}[0-9a-fA-F]{0,4}$/;return ipv4Regex.test(ip)||ipv6Regex.test(ip)},clearCache:function(){this.memoryCache=null;this.memoryCacheTime=null;try{sessionStorage.removeItem(this.sessionKey);sessionStorage.removeItem(this.sessionTimeKey)}catch(e){}}};var DeviceID={storageKey:'_ca_device_id',cookieName:'_ca_device_id',get:function(){var id=this.getFromStorage();if(id){if(config.debug)console.log('Device ID from storage:',id);return id}
12id=this.getFromCookie();
12if(id){if(config.debug)console.log('Device ID from cookie:',id);return id}
13id=this.generate();this.save(id);if(config.debug)console.log('Generated new device ID:',id);return id},generate:function(){var uuid='xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g,function(c){var r=Math.random()*16|0;var v=c==='x'?r:(r&0x3|0x8);return v.toString(16)});return'ca_'+uuid},isValid:function(id){return typeof id==='string'&&/^ca_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(id.trim())},set:function(id){if(!this.isValid(id)){if(config.debug)console.warn('Conceptual Analytics: Invalid device ID');return!1}
14this.save(id.trim());return!0},getFromStorage:function(){try{return localStorage.getItem(this.storageKey)}catch(e){return null}},getFromCookie:function(){var name=this.cookieName+'=';var decodedCookie=decodeURIComponent(document.cookie);var ca=decodedCookie.split(';');for(var i=0;i<ca.length;i++){var c=ca[i];while(c.charAt(0)===' '){c=c.substring(1)}
15if(c.indexOf(name)===0){return c.substring(name.length,c.length)}}
16return null},getRootDomain:function(){var hostname=window.location.hostname;if(hostname==='localhost'||/^(\d{1,3}\.){3}\d{1,3}$/.test(hostname)){return''}
17var parts=hostname.split('.');if(parts.length<=1){return''}
18var rootDomain='.'+parts.slice(-2).join('.');if(config.debug)console.log('Root domain for cookies:',rootDomain);return rootDomain},save:function(id){try{localStorage.setItem(this.storageKey,id)}catch(e){}
19var expires=new Date();expires.setFullYear(expires.getFullYear()+10);var domain=this.getRootDomain();var cookieStr=this.cookieName+'='+id+';expires='+expires.toUTCString()+';path=/;SameSite=Lax';if(domain){cookieStr+=';domain='+domain}
20document.cookie=cookieStr;if(config.debug){console.log('Saved device ID cookie:',cookieStr)}},clear:function(){try{localStorage.removeItem(this.storageKey)}catch(e){}
21var domain=this.getRootDomain();var cookieStr=this.cookieName+'=;expires=Thu, 01 Jan 1970 00:00:00 UTC;path=/;SameSite=Lax';if(domain){cookieStr+=';domain='+domain}
22document.cookie=cookieStr}};var ClickIDManager={cookieExpiry:30,clickIds:['gclid','gbraid','wbraid','fbclid','msclkid','ttclid','rdt_cid','rdt_uuid','li_fat_id','twclid','sc_click_id','oppref'],utmParams:['utm_source','utm_medium','utm_campaign','utm_term','utm_content'],ccParams:['cc_platform','cc_campaignid','cc_adgroupid','cc_adid','cc_keyword','cc_matchtype','cc_device','cc_network','cc_placement','cc_location','cc_adposition'],init:function(){this.persistClickIds();this.persistUTMs();this.persistCCParams();if(config.debug){console.log('[CA] ClickIDManager initialized')}},persistClickIds:function(){var self=this;this.clickIds.forEach(function(param){var urlValue=self.getClickIdUrlValue(param);var existing=self.getCookie('_ca_'+param);var shouldPersist=urlValue&&(!existing||(param==='oppref'&&existing!==urlValue));if(shouldPersist){var expires=new Date();expires.setDate(expires.getDate()+self.cookieExpiry);var domain=DeviceID.getRootDomain();var cookieStr='_ca_'+param+'='+urlValue+';expires='+expires.toUTCString()+';path=/;SameSite=Lax';if(domain){cookieStr+=';domain='+domain}
23document.cookie=cookieStr;if(config.debug){console.log('[CA] Persisted '+param+':',urlValue)}}})},persistUTMs:function(){var self=this;this.utmParams.forEach(function(param){var urlValue=self.getUrlParam(param);if(urlValue&&!self.getCookie('_ca_'+param)){var expires=new Date();expires.setDate(expires.getDate()+self.cookieExpiry);var domain=DeviceID.getRootDomain();var cookieStr='_ca_'+param+'='+encodeURIComponent(urlValue)+';expires='+expires.toUTCString()+';path=/;SameSite=Lax';if(domain){cookieStr+=';domain='+domain}
24document.cookie=cookieStr;if(config.debug){console.log('[CA] Persisted '+param+':',urlValue)}}})},persistCCParams:function(){var self=this;this.ccParams.forEach(function(param){var urlValue=self.getUrlParam(param);if(urlValue&&!self.getCookie('_ca_'+param)){var expires=new Date();expires.setDate(expires.getDate()+self.cookieExpiry);var domain=DeviceID.getRootDomain();var cookieStr='_ca_'+param+'='+encodeURIComponent(urlValue)+';expires='+expires.toUTCString()+';path=/;SameSite=Lax';if(domain){cookieStr+=';domain='+domain}
25document.cookie=cookieStr;if(config.debug){console.log('[CA] Persisted '+param+':',urlValue)}}})},getUrlParam:function(name){var regex=new RegExp('[?&]'+name+'=([^&#]*)');var results=regex.exec(window.location.search);return results?decodeURIComponent(results[1]):null},getClickIdUrlValue:function(name){if(name==='sc_click_id'){return this.getUrlParam('sc_click_id')||this.getUrlParam('ScCid')||this.getUrlParam('sccid')}
26return this.getUrlParam(name)},getCookie:function(name){var nameEQ=name+'=';var ca=document.cookie.split(';');for(var i=0;i<ca.length;i++){var c=ca[i];while(c.charAt(0)===' ')c=c.substring(1,c.length);if(c.indexOf(nameEQ)===0)return c.substring(nameEQ.length,c.length);}
27return null},getPersistedClickId:function(name){if(name==='oppref'){return this.getClickIdUrlValue(name)||this.getCookie('__oppref')||this.getCookie('_ca_'+name)||this.getCookie(name)}
28return this.getClickIdUrlValue(name)||this.getCookie('_ca_'+name)||this.getCookie(name)},getPersistedUTM:function(name){var value=this.getUrlParam(name)||this.getCookie('_ca_'+name)||this.getCookie(name);return value?decodeURIComponent(value):null},clearAll:function(){var self=this;var domain=DeviceID.getRootDomain();this.clickIds.forEach(function(param){var cookieStr='_ca_'+param+'=;expires=Thu, 01 Jan 1970 00:00:00 UTC;path=/;SameSite=Lax';if(domain){cookieStr+=';domain='+domain}
29document.cookie=cookieStr});
29this.utmParams.forEach(function(param){var cookieStr='_ca_'+param+'=;expires=Thu, 01 Jan 1970 00:00:00 UTC;path=/;SameSite=Lax';if(domain){cookieStr+=';domain='+domain}
30document.cookie=cookieStr})}};var Analytics={initialized:!1,queue:[],init:function(apiKey,options){if(this.initialized)return;config.apiKey=apiKey||config.apiKey;if(options){for(var key in options){if(config.hasOwnProperty(key)){config[key]=options[key]}}}
31if(config.respectDNT&&this.isDNT()){console.log('Conceptual Analytics: Respecting Do Not Track');return}
32if(config.customDomain){config.trackEndpoint='//'+config.customDomain+'/api/v1/track';config.identifyEndpoint='//'+config.customDomain+'/api/v1/identify'}
33this.initialized=!0;ClickIDManager.init();IPManager.getIP().catch(function(e){if(config.debug)console.warn('Failed to prefetch IP:',e);});this.processQueue();if(this.readyCallbacks){this.readyCallbacks.forEach(function(callback){callback()});this.readyCallbacks=[]}
34if(config.trackPageViews){this.track('page_view')}
35if(config.trackUnload){this.setupUnloadTracking()}
36if(window[globalName].readyCallbacks){window[globalName].readyCallbacks.forEach(function(callback){callback()})}},track:function(eventName,properties,options){if(!this.initialized){this.queue.push(['track',eventName,properties,options]);return}
37var event=this.buildEvent(eventName,properties,options);if(options&&options.transport==='beacon'){this.sendBeacon(event)}else{this.sendEvent(event)}},identify:function(userId,traits,options){if(!this.initialized){this.queue.push(['identify',userId,traits,options]);return}
38var identifyOptions=options||{};var shouldPersistUserId=identifyOptions.persistUserId!==!1;if(shouldPersistUserId){try{localStorage.setItem('_ca_user_id',userId);if(traits){localStorage.setItem('_ca_user_traits',JSON.stringify(traits))}}catch(e){}}else if(config.debug){console.log('[CA] Sending identify without persisting browser user ID')}
39var identifyData={user_id:userId,device_id:DeviceID.get(),email:traits&&traits.email?traits.email:null,email_sha256:traits&&traits.email_sha256?traits.email_sha256:null,traits:traits||{},timestamp:new Date().toISOString(),fbp:this.getCookie('_fbp'),fbc:this.getCookie('_fbc'),url:window.location.href,referrer:document.referrer,utm_source:(traits&&traits.utm_source)||ClickIDManager.getPersistedUTM('utm_source'),utm_medium:(traits&&traits.utm_medium)||ClickIDManager.getPersistedUTM('utm_medium'),utm_campaign:(traits&&traits.utm_campaign)||ClickIDManager.getPersistedUTM('utm_campaign'),utm_term:(traits&&traits.utm_term)||ClickIDManager.getPersistedUTM('utm_term'),utm_content:(traits&&traits.utm_content)||ClickIDManager.getPersistedUTM('utm_content'),gclid:(traits&&traits.gclid)||ClickIDManager.getPersistedClickId('gclid'),gbraid:(traits&&traits.gbraid)||ClickIDManager.getPersistedClickId('gbraid'),wbraid:(traits&&traits.wbraid)||ClickIDManager.getPersistedClickId('wbraid'),fbclid:(traits&&traits.fbclid)||ClickIDManager.getPersistedClickId('fbclid'),msclkid:(traits&&traits.msclkid)||ClickIDManager.getPersistedClickId('msclkid'),ttclid:(traits&&traits.ttclid)||ClickIDManager.getPersistedClickId('ttclid'),rdt_cid:(traits&&traits.rdt_cid)||ClickIDManager.getPersistedClickId('rdt_cid'),rdt_uuid:(traits&&traits.rdt_uuid)||ClickIDManager.getPersistedClickId('rdt_uuid'),li_fat_id:(traits&&traits.li_fat_id)||ClickIDManager.getPersistedClickId('li_fat_id'),twclid:(traits&&traits.twclid)||ClickIDManager.getPersistedClickId('twclid'),sc_click_id:(traits&&traits.sc_click_id)||ClickIDManager.getPersistedClickId('sc_click_id'),oppref:(traits&&traits.oppref)||ClickIDManager.getPersistedClickId('oppref'),obref:(traits&&traits.obref)||this.getCookie('__obref'),ttp:this.getCookie('_ttp'),sc_cookie1:this.getCookie('_scid'),};if(identifyOptions.dedupeId){identifyData.dedupe_id=identifyOptions.dedupeId}
40ClickIDManager.ccParams.forEach(function(param){var paramValue=(traits&&traits[param])||ClickIDManager.getUrlParam(param)||ClickIDManager.getCookie('_ca_'+param);if(paramValue){identifyData[param]=paramValue}});if(identifyOptions.transport==='beacon'){this.sendIdentifyBeacon(identifyData)}else{this.sendIdentify(identifyData)}
41this.track('identify',{user_id:userId,email:traits&&traits.email?traits.email:null,email_sha256:traits&&traits.email_sha256?traits.email_sha256:null,traits_count:traits?Object.keys(traits).length:0},{userId:userId,transport:identifyOptions.transport})},sendIdentify:function(data){var self=this;IPManager.getIP().then(function(clientIP){if(clientIP){data.client_ip=clientIP}
42var url=config.identifyEndpoint+(config.identifyEndpoint.indexOf('?')>-1?'&':'?')+'key='+encodeURIComponent(config.apiKey);if(window.fetch){fetch(url,{method:'POST',headers:{'Content-Type':'text/plain'},body:JSON.stringify(data),keepalive:!0}
42).catch(function(error){if(config.debug)console.error('Analytics identify error:',error);})}else{var xhr=new XMLHttpRequest();xhr.open('POST',url,!0);xhr.setRequestHeader('Content-Type','text/plain');xhr.send(JSON.stringify(data))}
43if(config.debug){console.log('Analytics identify:',data)}})},sendIdentifyBeacon:function(data){if(IPManager.memoryCache){data.client_ip=IPManager.memoryCache}
44var url=config.identifyEndpoint+(config.identifyEndpoint.indexOf('?')>-1?'&':'?')+'key='+encodeURIComponent(config.apiKey);this.sendBeaconPayload(url,data,'identify')},buildEvent:function(eventName,properties,options){var browserData=BrowserCapabilities.collect();var eventOptions=options||{};var event={event_id:'evt_'+Date.now()+'_'+Math.random().toString(36).substr(2,9),device_id:DeviceID.get(),event_type:eventName,timestamp:new Date().toISOString(),url:window.location.href,path:window.location.pathname,search:window.location.search,hash:window.location.hash,title:document.title,referrer:document.referrer,viewport:{width:window.innerWidth,height:window.innerHeight},utm_source:ClickIDManager.getPersistedUTM('utm_source'),utm_medium:ClickIDManager.getPersistedUTM('utm_medium'),utm_campaign:ClickIDManager.getPersistedUTM('utm_campaign'),utm_term:ClickIDManager.getPersistedUTM('utm_term'),utm_content:ClickIDManager.getPersistedUTM('utm_content'),gclid:ClickIDManager.getPersistedClickId('gclid'),gbraid:ClickIDManager.getPersistedClickId('gbraid'),wbraid:ClickIDManager.getPersistedClickId('wbraid'),fbclid:ClickIDManager.getPersistedClickId('fbclid'),msclkid:ClickIDManager.getPersistedClickId('msclkid'),ttclid:ClickIDManager.getPersistedClickId('ttclid'),rdt_cid:ClickIDManager.getPersistedClickId('rdt_cid'),rdt_uuid:ClickIDManager.getPersistedClickId('rdt_uuid'),li_fat_id:ClickIDManager.getPersistedClickId('li_fat_id'),twclid:ClickIDManager.getPersistedClickId('twclid'),sc_click_id:ClickIDManager.getPersistedClickId('sc_click_id'),oppref:ClickIDManager.getPersistedClickId('oppref'),obref:this.getCookie('__obref'),ttp:this.getCookie('_ttp'),sc_cookie1:this.getCookie('_scid'),fbp:this.getCookie('_fbp'),fbc:this.getCookie('_fbc'),browser_info:browserData,properties:properties||{}};if(Object.prototype.hasOwnProperty.call(eventOptions,'userId')){if(eventOptions.userId){event.user_id=eventOptions.userId}}else{try{var userId=localStorage.getItem('_ca_user_id');if(userId){event.user_id=userId}}catch(e){}}
45if(eventOptions.dedupeId){event.dedupe_id=eventOptions.dedupeId}
46return event},sendEvent:function(event){IPManager.getIP().then(function(clientIP){if(clientIP){event.client_ip=clientIP}
47var url=config.trackEndpoint+(config.trackEndpoint.indexOf('?')>-1?'&':'?')+'key='+encodeURIComponent(config.apiKey);if(window.fetch){fetch(url,{method:'POST',headers:{'Content-Type':'text/plain'},body:JSON.stringify(event),keepalive:!0}).catch(function(error){if(config.debug)console.error('Analytics error:',error);})}else{var xhr=new XMLHttpRequest();xhr.open('POST',url,!0);xhr.setRequestHeader('Content-Type','text/plain');xhr.send(JSON.stringify(event))}
48if(config.debug){console.log('Analytics event:',event)}})},sendBeacon:function(event){if(IPManager.memoryCache){event.client_ip=IPManager.memoryCache}
49var url=config.trackEndpoint+(config.trackEndpoint.indexOf('?')>-1?'&':'?')+'key='+encodeURIComponent(config.apiKey);this.sendBeaconPayload(url,event,'event')},sendBeaconPayload:function(url,payload,label){var serialized=JSON.stringify(payload);if(navigator.sendBeacon){var blob=new Blob([serialized],{type:'text/plain'});if(navigator.sendBeacon(url,blob)){if(config.debug)console.log('Analytics '+label+' beacon:',payload);return}}
50if(window.fetch){fetch(url,{method:'POST',headers:{'Content-Type':'text/plain'},body:serialized,keepalive:!0}).catch(function(error){if(config.debug)console.error('Analytics '+label+' beacon fallback error:',error);});return}
51var xhr=new XMLHttpRequest();xhr.open('POST',url,!1);xhr.setRequestHeader('Content-Type','text/plain');xhr.send(serialized)},setupUnloadTracking:function(){this.setupScrollTracking();this.setupInteractionTracking()},setupInteractionTracking:function(){var self=this;try{if(config.autoFormLeadDetectionEnabled){document.addEventListener('submit',function(e){try{self.handleAutomaticFormLeadSubmit(e)}catch(err){if(config.debug)console.error('Automatic form lead detection error:',err);}},!0);window.addEventListener('message',function(event){try{self.handleHubSpotFormMessage(event)}catch(err){if(config.debug)console.error('HubSpot form detection error:',err);}})}}catch(e){if(config.debug)console.error('Failed to setup interaction tracking:',e);}},trackFormSubmit:function(e){var form=e.target;var formData={form_id:form.id||null,form_name:form.name||null,form_action:form.action||null,form_method:form.method||'GET',form_classes:form.className||null};var fields=form.querySelectorAll('input, textarea, select');var filledFields=0;var totalFields=0;var fieldTypes=[];for(var i=0;i<fields.length;i++){var field=fields[i];var type=field.type||field.tagName.toLowerCase();if(type==='hidden'||type==='submit'||type==='button')continue;totalFields++;if(type==='checkbox'||type==='radio'){if(field.checked)filledFields++}else if(field.value&&field.value.trim()){filledFields++}
52if(fieldTypes.indexOf(type)===-1){fieldTypes.push(type)}}
53formData.fields_filled=filledFields;formData.total_fields=totalFields;formData.completion_rate=totalFields>0?Math.round((filledFields/totalFields)*100):0;formData.field_types=fieldTypes;formData.has_email_field=form.querySelector('input[type="email"]')!==null;formData.has_phone_field=form.querySelector('input[type="tel"]')!==null;formData.has_file_field=form.querySelector('input[type="file"]')!==null;var event=this.buildEvent('form_submit',formData);if(IPManager.memoryCache){event.client_ip=IPManager.memoryCache}
54if(navigator.sendBeacon){var url=config.trackEndpoint+(config.trackEndpoint.indexOf('?')>-1?'&':'?')+'key='+encodeURIComponent(config.apiKey);var blob=new Blob([JSON.stringify(event)],{type:'text/plain'});navigator.sendBeacon(url,blob)}else{this.sendEvent(event)}},handleAutomaticFormLeadSubmit:function(e){var form=e&&e.target;if(!form||!form.tagName||form.tagName.toLowerCase()!=='form'){return}
55var lead=this.extractAutomaticLead(form);if(!lead){return}
56if(this.hasRecentAutomaticLeadDetection([lead.dedupeKey,lead.recentLeadKey])){if(config.debug){console.log('[CA] Skipping duplicate automatic lead detection',lead.dedupeKey)}
57return}
58var userId=this.resolveAutomaticLeadUserId(lead.email);this.identify(userId,lead.traits,{persistUserId:!1});this.track(config.autoFormLeadDetectedEventName,{automatic:!0,source:'automatic_form_detection',form_id:lead.formId,form_name:lead.formName,form_action:lead.formAction,form_method:lead.formMethod,form_signature:lead.formSignature,submit_text:lead.submitText,field_types:lead.fieldTypes,detected_fields:lead.detectedFields,has_phone:!!lead.traits.phone,has_company:!!lead.traits.company_name},{userId:userId});this.rememberAutomaticLeadDetection([lead.dedupeKey,lead.recentLeadKey])},handleHubSpotFormMessage:function(event){if(!event){return}
59var payload=this.parseHubSpotMessagePayload(event.data);if(!payload||payload.type!=='hsFormCallback'||payload.eventName!=='onFormSubmitted'){return}
60var lead=this.extractHubSpotLead(payload);if(!lead){return}
61if(this.hasRecentAutomaticLeadDetection([lead.dedupeKey,lead.recentLeadKey])){if(config.debug){console.log('[CA] Skipping duplicate HubSpot lead detection',lead.dedupeKey)}
62return}
63var userId=this.resolveAutomaticLeadUserId(lead.email);this.identify(userId,lead.traits,{persistUserId:!1});this.track(config.autoFormLeadDetectedEventName,{automatic:!0,source:'hubspot_form_detection',provider:'hubspot',submission_persisted:!0,form_id:lead.formId,form_signature:lead.formSignature,detected_fields:lead.detectedFields,has_phone:!!lead.traits.phone,has_company:!!lead.traits.company_name},{userId:userId});this.rememberAutomaticLeadDetection([lead.dedupeKey,lead.recentLeadKey])},extractAutomaticLead:function(form){if(!window.FormData){return null}
64var elements=form.elements||[];var fieldTypes=[];var fieldNames=[];var values={email:null,phone:null,company_name:null,first_name:null,last_name:null,name:null};for(var i=0;i<elements.length;i++){var element=elements[i];if(!element||element.disabled){continue}
65var tagName=(element.tagName||'').toLowerCase();var type=(element.type||tagName).toLowerCase();
65var fieldName=((element.name||element.id||'')+'').toLowerCase();if(type==='hidden'||type==='submit'||type==='button'||type==='reset'||type==='file'||type==='image'){continue}
66if(fieldTypes.indexOf(type)===-1){fieldTypes.push(type)}
67if(fieldName&&fieldNames.indexOf(fieldName)===-1){fieldNames.push(fieldName)}
68var value=this.getFormFieldValue(element);if(!value){continue}
69if(!values.email&&(type==='email'||fieldName.indexOf('email')!==-1)&&this.isValidEmail(value)){values.email=value.toLowerCase();continue}
70if(!values.phone&&(type==='tel'||this.fieldNameLooksLike(fieldName,['phone','mobile','tel']))){values.phone=value;continue}
71if(!values.company_name&&this.fieldNameLooksLike(fieldName,['company','organization','organisation','business','employer','workspace'])){values.company_name=value;continue}
72if(!values.first_name&&this.fieldNameLooksLike(fieldName,['first_name','firstname','first-name','fname','given-name'])){values.first_name=value;continue}
73if(!values.last_name&&this.fieldNameLooksLike(fieldName,['last_name','lastname','last-name','lname','family-name','surname'])){values.last_name=value;continue}
74if(!values.name&&this.fieldNameLooksLike(fieldName,['full_name','fullname','your_name','contact_name'])){values.name=value;continue}
75if(!values.name&&fieldName==='name'&&!this.fieldNameLooksLike(fieldName,['company'])){values.name=value}}
76if(!values.email){return null}
77var submitText=this.getFormSubmitText(form);if(this.isAutomaticLeadCaptureExcluded(form,fieldNames,fieldTypes,submitText)){return null}
78if(values.name&&(!values.first_name||!values.last_name)){var splitName=this.splitFullName(values.name);if(!values.first_name&&splitName.first_name){values.first_name=splitName.first_name}
79if(!values.last_name&&splitName.last_name){values.last_name=splitName.last_name}}
80var formAction=this.sanitizeFormAction(form.action);var formSignature=this.buildAutomaticFormSignature(form,fieldNames,formAction,submitText);var detectedFields=[];if(values.email)detectedFields.push('email');if(values.first_name)detectedFields.push('first_name');if(values.last_name)detectedFields.push('last_name');if(values.phone)detectedFields.push('phone');if(values.company_name)detectedFields.push('company_name');var traits={email:values.email,phone:values.phone||null,first_name:values.first_name||null,last_name:values.last_name||null,company_name:values.company_name||null,company:values.company_name||null,automatic_form_capture:!0,lead_capture_source:'automatic_form_detection',lead_capture_form_signature:formSignature,lead_capture_form_id:form.id||null,lead_capture_form_name:form.name||null,lead_capture_form_action:formAction,lead_capture_submit_text:submitText||null};return{email:values.email,traits:traits,dedupeKey:this.hashString([window.location.hostname,values.email,formSignature].join('|')),recentLeadKey:this.buildRecentAutomaticLeadKey(values.email),formId:form.id||null,formName:form.name||null,formAction:formAction,formMethod:form.method||'GET',formSignature:formSignature,submitText:submitText,fieldTypes:fieldTypes,detectedFields:detectedFields}},extractHubSpotLead:function(payload){var data=payload.data||{};var submissionValues=data.submissionValues||data;var values={email:null,phone:null,company_name:null,first_name:null,last_name:null,name:null};var detectedFields=[];if(!submissionValues||typeof submissionValues!=='object'){return null}
81for(var key in submissionValues){if(!Object.prototype.hasOwnProperty.call(submissionValues,key)){continue}
82var rawValue=submissionValues[key];var normalizedValue=Array.isArray(rawValue)?rawValue.join(',').trim():((rawValue||'')+'').trim();if(!normalizedValue){continue}
83var normalizedKey=(key+'').toLowerCase();if(!values.email&&this.fieldNameLooksLike(normalizedKey,['email'])&&this.isValidEmail(normalizedValue)){values.email=normalizedValue.toLowerCase();detectedFields.push('email');continue}
84if(!values.phone&&this.fieldNameLooksLike(normalizedKey,['phone','mobile','tel'])){values.phone=normalizedValue;detectedFields.push('phone');continue}
85if(!values.company_name&&this.fieldNameLooksLike(normalizedKey,['company','organization','organisation','business','employer','workspace'])){values.company_name=normalizedValue;detectedFields.push('company_name');continue}
86if(!values.first_name&&this.fieldNameLooksLike(normalizedKey,['firstname','first_name','first-name','fname','givenname','given_name','given-name'])){values.first_name=normalizedValue;detectedFields.push('first_name');continue}
87if(!values.last_name&&this.fieldNameLooksLike(normalizedKey,['lastname','last_name','last-name','lname','familyname','family_name','surname'])){values.last_name=normalizedValue;detectedFields.push('last_name');continue}
88if(!values.name&&this.fieldNameLooksLike(normalizedKey,['fullname','full_name','full-name','name'])){values.name=normalizedValue}}
89if(!values.email){return null}
90if(values.name&&(!values.first_name||!values.last_name)){var splitName=this.splitFullName(values.name);if(!values.first_name&&splitName.first_name){values.first_name=splitName.first_name;detectedFields.push('first_name')}
91if(!values.last_name&&splitName.last_name){values.last_name=splitName.last_name;detectedFields.push('last_name')}}
92var formId=payload.id||null;var formSignature=formId?'hs_'+this.hashString(formId):'hs_'+this.hashString(window.location.pathname);var traits={email:values.email,phone:values.phone||null,first_name:values.first_name||null,last_name:values.last_name||null,company_name:values.company_name||null,company:values.company_name||null,automatic_form_capture:!0,lead_capture_source:'hubspot_form_detection',lead_capture_provider:'hubspot',lead_capture_form_signature:formSignature,lead_capture_form_id:formId,lead_capture_redirect_url:data.redirectUrl||null};return{email:values.email,traits:traits,dedupeKey:this.hashString([window.location.hostname,values.email,formSignature].join('|')),recentLeadKey:this.buildRecentAutomaticLeadKey(values.email),formId:formId,formSignature:formSignature,detectedFields:detectedFields}},isAutomaticLeadCaptureExcluded:function(form,fieldNames,fieldTypes,submitText){var identifiers=[form.id||'',form.name||'',form.className||'',form.action||'',submitText||''].join(' ').toLowerCase();var excludedKeywords=['login','log in','signin','sign in','password','reset','forgot','search','checkout','payment','billing','cart','coupon','promo','otp','2fa'];for(var i=0;i<excludedKeywords.length;i++){if(identifiers.indexOf(excludedKeywords[i])!==-1){return!0}}
93if(fieldTypes.indexOf('password')!==-1||fieldTypes.indexOf('search')!==-1){return!0}
94var fieldBlob=fieldNames.join(' ');var paymentKeywords=['card','cardnumber','card_number','cc-number','cc_number','ccnum','cvc','cvv','expiry','exp_month','exp_year','iban','routing'];for(var j=0;j<paymentKeywords.length;j++){if(fieldBlob.indexOf(paymentKeywords[j])!==-1){return!0}}
95return!1},getFormFieldValue:function(element){if(!element){return''}
96var type=(element.type||'').toLowerCase();if((type==='checkbox'||type==='radio')&&!element.checked){return''}
97if(element.tagName&&element.tagName.toLowerCase()==='select'&&element.multiple){var values=[];for(var i=0;i<element.options.length;i++){if(element.options[i].selected){values.push(element.options[i].value)}}
98return values.join(',').trim()}
99return((element.value||'')+'').trim()},getFormSubmitText:function(form){var submit=form.querySelector('button[type="submit"], input[type="submit"]');if(!submit){return''}
100return this.getElementText(submit).substring(0,100)},sanitizeFormAction:function(action){var rawAction=action||window.location.href;try{var parsed=new URL(rawAction,window.location.href);return(parsed.origin+parsed.pathname).substring(0,255)}catch(e){return rawAction.substring(0,255)}},buildAutomaticFormSignature:function(form,fieldNames,formAction,submitText){var signatureParts=[form.id||'',form.name||'',formAction||'',submitText||'',fieldNames.slice().sort().join(',')];return'afs_'+this.hashString(signatureParts.join('|'))},hasRecentAutomaticLeadDetection:function(keys){var cache=this.getAutomaticLeadDetectionCache();var keyList=Array.isArray(keys)?keys:[keys];for(var i=0;i<keyList.length;i++){var key=keyList[i];if(!key){continue}
101var timestamp=cache[key];if(!timestamp){continue}
102var ttl=this.getAutomaticLeadDetectionTtlForKey(key);if((Date.now()-timestamp)<ttl){return!0}}
103return!1},rememberAutomaticLeadDetection:function(keys){var cache=this.getAutomaticLeadDetectionCache();var now=Date.now();var keyList=Array.isArray(keys)?keys:[keys];for(var i=0;i<keyList.length;i++){if(keyList[i]){cache[keyList[i]]=now}}
104for(var key in cache){if(Object.prototype.hasOwnProperty.call(cache,key)&&
104(now-cache[key])>=this.getAutomaticLeadDetectionTtlForKey(key)){delete cache[key]}}
105try{sessionStorage.setItem('_ca_auto_form_leads',JSON.stringify(cache))}catch(e){if(config.debug)console.warn('Failed to persist automatic form lead cache:',e);}},getAutomaticLeadDetectionCache:function(){try{var raw=sessionStorage.getItem('_ca_auto_form_leads');if(raw){var parsed=JSON.parse(raw);if(parsed&&typeof parsed==='object'){return parsed}}}catch(e){if(config.debug)console.warn('Failed to read automatic form lead cache:',e);}
106return{}},getAutomaticLeadDetectionTtlForKey:function(key){if((key||'').indexOf('recent:')===0){return config.autoFormLeadRecentDedupTtlMs}
107return config.autoFormLeadDedupTtlMs},buildRecentAutomaticLeadKey:function(email){return'recent:'+this.hashString([window.location.hostname.toLowerCase(),window.location.pathname,email.toLowerCase()].join('|'))},resolveAutomaticLeadUserId:function(email){return'auto_form_'+this.hashString([config.apiKey||window.location.hostname.toLowerCase(),email.toLowerCase()].join('|'))},fieldNameLooksLike:function(fieldName,patterns){if(!fieldName){return!1}
108for(var i=0;i<patterns.length;i++){if(fieldName.indexOf(patterns[i])!==-1){return!0}}
109return!1},splitFullName:function(name){var cleaned=(name||'').replace(/\s+/g,' ').trim();if(!cleaned){return{first_name:null,last_name:null}}
110var parts=cleaned.split(' ');return{first_name:parts[0]||null,last_name:parts.length>1?parts.slice(1).join(' '):null}},isValidEmail:function(email){return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test((email||'').toLowerCase())},parseHubSpotMessagePayload:function(payload){if(!payload){return null}
111if(typeof payload==='string'){try{return JSON.parse(payload)}catch(e){return null}}
112if(typeof payload==='object'){return payload}
113return null},hashString:function(input){var hash=5381;var str=input||'';for(var i=0;i<str.length;i++){hash=((hash<<5)+hash)+str.charCodeAt(i);hash=hash&hash}
114return Math.abs(hash).toString(16)},trackButtonClick:function(e){var element=e.target;var maxDepth=3;while(element&&maxDepth>0){if(element.matches&&element.matches('button, input[type="button"], input[type="submit"], a, [role="button"], .btn')){break}
115element=element.parentElement;maxDepth--}
116if(!element||!element.matches)return;if(!element.matches('button, input[type="button"], input[type="submit"], a, [role="button"], .btn'))return;var clickData={element_type:element.tagName.toLowerCase(),element_id:element.id||null,element_classes:element.className||null,element_text:this.getElementText(element).substring(0,100),element_href:element.href||null,element_target:element.target||null};var dataAttrs={};for(var i=0;i<element.attributes.length;i++){var attr=element.attributes[i];if(attr.name.indexOf('data-')===0){dataAttrs[attr.name]=attr.value}}
117if(Object.keys(dataAttrs).length>0){clickData.data_attributes=dataAttrs}
118var ctaClasses=['cta','btn-primary','btn-success','submit','download','signup','register'];clickData.is_cta=ctaClasses.some(function(cls){return element.className&&element.className.indexOf(cls)!==-1});if(element.href){var linkUrl=new URL(element.href,window.location.href);clickData.is_outbound=linkUrl.hostname!==window.location.hostname;clickData.link_domain=linkUrl.hostname}
119this.track('button_click',clickData)},getElementText:function(element){var text=element.getAttribute('aria-label')||element.getAttribute('title')||element.innerText||element.textContent||element.value||'';return text.replace(/\s+/g,' ').trim()},setupScrollTracking:function(){var self=this;var scrollMilestones={'500px':!1,'25%':!1,'50%':!1,'75%':!1,'90%':!1,'100%':!1};var reachedComplete=!1;var completeCooldownTimer=null;var debounceTimer=null;var lastScrollTop=0;function getScrollPercentage(){var scrollTop=window.pageYOffset||document.documentElement.scrollTop;var scrollHeight=document.documentElement.scrollHeight-window.innerHeight;return scrollHeight>0?(scrollTop/scrollHeight)*100:0}
120function checkScrollMilestones(){var scrollTop=window.pageYOffset||document.documentElement.scrollTop;var scrollPercentage=getScrollPercentage();if(scrollTop<=lastScrollTop){lastScrollTop=scrollTop;return}
121lastScrollTop=scrollTop;if(!scrollMilestones['500px']&&scrollTop>=500){scrollMilestones['500px']=!0;self.track('scroll_milestone',{milestone:'500px',scroll_depth:scrollTop,percentage:0})}
122var percentageMilestones=[{key:'25%',value:25},{key:'50%',value:50},{key:'75%',value:75},{key:'90%',value:90},{key:'100%',value:98}];
122percentageMilestones.forEach(function(milestone){if(reachedComplete&&milestone.key==='100%'){return}
123if(!scrollMilestones[milestone.key]&&scrollPercentage>=milestone.value){scrollMilestones[milestone.key]=!0;if(milestone.key==='100%'){reachedComplete=!0;if(completeCooldownTimer)clearTimeout(completeCooldownTimer);completeCooldownTimer=setTimeout(function(){reachedComplete=!1},5000)}
124var percentageValue=milestone.key==='100%'?100:parseInt(milestone.key);self.track('scroll_milestone',{milestone:milestone.key,scroll_depth:scrollTop,percentage:percentageValue})}})}
125function handleScroll(){if(debounceTimer){clearTimeout(debounceTimer)}
126debounceTimer=setTimeout(checkScrollMilestones,500)}},ready:function(callback){if(this.initialized){callback()}else{this.readyCallbacks=this.readyCallbacks||[];this.readyCallbacks.push(callback)}},getDeviceId:function(){return DeviceID.get()},setDeviceId:function(deviceId){return DeviceID.set(deviceId)},processQueue:function(){var self=this;window[globalName].q.forEach(function(args){var method=args[0];if(self[method]){self[method].apply(self,Array.prototype.slice.call(args,1))}});window[globalName].q=[]},getParam:function(name){var regex=new RegExp('[?&]'+name+'=([^&#]*)');var results=regex.exec(window.location.search);return results?decodeURIComponent(results[1]):null},getCookie:function(name){try{var value='; '+document.cookie;var parts=value.split('; '+name+'=');if(parts.length===2){return parts.pop().split(';').shift()}}catch(e){}
127return null},isDNT:function(){return navigator.doNotTrack==='1'||window.doNotTrack==='1'||navigator.msDoNotTrack==='1'},deidentify:function(){this.track('deidentify',{old_device_id:DeviceID.get()});try{localStorage.removeItem('_ca_user_id');localStorage.removeItem('_ca_user_traits');localStorage.removeItem('_ca_debug')}catch(e){if(config.debug)console.warn('Failed to clear user data:',e);}
128IPManager.clearCache();ClickIDManager.clearAll();DeviceID.clear();var newDeviceId=DeviceID.generate();DeviceID.save(newDeviceId);if(config.debug){console.log('Deidentified - new device ID:',newDeviceId)}
129return newDeviceId}};var stub=window[globalName];window[globalName]=function(){var args=Array.prototype.slice.call(arguments);var method=args[0];if(Analytics[method]){Analytics[method].apply(Analytics,args.slice(1))}else{if(config.debug)console.error('Unknown method:',method);}};window[globalName].q=stub.q||[];window[globalName].l=stub.l;window[globalName].apiKey=stub.apiKey;window[globalName].customDomain=stub.customDomain||config.customDomain;window[globalName].initialized=!0;window[globalName].track=function(eventName,properties,options){Analytics.track(eventName,properties,options)};window[globalName].identify=function(userId,traits,options){Analytics.identify(userId,traits,options)};window[globalName].ready=function(callback){Analytics.ready(callback)};window[globalName].getDeviceId=function(){return Analytics.getDeviceId()};window[globalName].setDeviceId=function(deviceId){return Analytics.setDeviceId(deviceId)};window[globalName].deidentify=function(){return Analytics.deidentify()};if(typeof window.track==='undefined'){window.track=function(eventName,properties){Analytics.track(eventName,properties)};if(config.debug)console.log('Conceptual Analytics: Global track() function registered');}else{if(config.debug)console.warn('Conceptual Analytics: track() already exists, use ca.track() instead');}
130if(apiKey||window[globalName].apiKey){Analytics.init(apiKey||window[globalName].apiKey)}
131Analytics.processQueue()})(window,document)

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.