function senp1(){this.plUrl="senp.png";this.sessionDuration=30*60*1000;this.lifetimeDuration=10*365*24*60*60*1000;this.debounceResetTimer=null;this.connectionSpeed=this.getConnectionSpeed();this.uuid=this.generateUUID();var self=this;this.isSampled=!0;var sentinelObject=this.extractKeyValue("config");var propertyId=sentinelObject.propertyId;var inactivePropertyReferences=[];if(inactivePropertyReferences.includes(propertyId)){this.isSampled=!0}else{var sampleRate=1;this.executeWithProbability(sampleRate,function(){self.isSampled=!1})} this.sendPings=!1;this.executeWithProbability(0.01,function(){self.sendPings=!0});this.utmDataCookieName="sentinelbi_utmData";var timestamp=this.extractKeyValue("initTimestamp")||Date.now();this.sendPl(timestamp,"pageview")};senp1.prototype.sendEngagementData=function(engagedSecondsStartTime,engagedDepth,initiator){if(!this.sentEngagement){this.sentEngagement=!0;var timestamp=Date.now();var delta=timestamp-engagedSecondsStartTime;var engagedSeconds=Math.floor(delta/1000);if(engagedSeconds>3600){engagedSeconds=3600} engagedDepth=Math.ceil(engagedDepth);if(engagedDepth>100){engagedDepth=100} this.sendPl(timestamp,"engagedSeconds",engagedSeconds,'beacon');this.sendPl(timestamp,"engagedDepth",engagedDepth,'beacon')}};senp1.prototype.sendPl=function(timestamp,type,typeValue='',sendMethod=''){var sentinelObject=this.extractKeyValue("config");if(!sentinelObject.accountName||!sentinelObject.propertyId){this.logError("accountName and propertyId are required");return} if(this.isSampled){this.logError("pixel sampled");return} var account=sentinelObject.accountName;var propertyId=sentinelObject.propertyId;var url="https://"+account+".sentinelpro.com/"+propertyId+"/"+this.plUrl;let params=new URLSearchParams();params.append("time",timestamp);params.append("permalink",window.location.pathname);params.append("url",window.location.href);var referrer=document.referrer;if(referrer){params.append("referrer",referrer)} if(this.connectionSpeed){params.append("connSpeed",this.connectionSpeed)} if(sentinelObject){var dimensions=sentinelObject.dimensions;if(dimensions){params.append("dimensions",JSON.stringify(dimensions))} var userDimensions=sentinelObject.userDimensions;if(userDimensions){params.append("userDimensions",JSON.stringify(userDimensions))} var internalDimensions=sentinelObject.internalDimensions;if(internalDimensions){params.append("internalDimensions",JSON.stringify(internalDimensions))}} this.setupUtmDataCookie(this.utmDataCookieName);var utmCookie=this.getCookieValue(this.utmDataCookieName);if(utmCookie){utmCookie=JSON.parse(decodeURIComponent(utmCookie));if("utm_campaign" in utmCookie){params.append("utm_campaign",utmCookie.utm_campaign)} if("utm_medium" in utmCookie){params.append("utm_medium",utmCookie.utm_medium)} if("utm_source" in utmCookie){params.append("utm_source",utmCookie.utm_source)}} params.append("type",type);params.append("typeValue",typeValue);params.append("uuid",this.uuid);if(this.sendPings){params.append("isPing",1)} if(sendMethod=='beacon'){navigator.sendBeacon(`${url}?${params.toString()}`)}else{var xhttp=new XMLHttpRequest();xhttp.open("GET",`${url}?${params.toString()}`,!0);xhttp.send()}};senp1.prototype.sendEvent=function(category,type,typeValue=''){if(this.isNullOrEmptyOrUndefined(category)||this.isNullOrEmptyOrUndefined(type)){this.logError("Event category and type are required to send an event");return} var sentinelObject=this.extractKeyValue("config");if(!sentinelObject.accountName||!sentinelObject.propertyId){this.logError("accountName and propertyId are required");return} if(this.isSampled){this.logError("pixel sampled");return} var account=sentinelObject.accountName;var propertyId=sentinelObject.propertyId;var url="https://"+account+".sentinelpro.com/"+propertyId+"/"+this.plUrl;let params=new URLSearchParams();params.append("time",Date.now());params.append("permalink",window.location.pathname);params.append("url",window.location.href);if(sentinelObject){var dimensions=sentinelObject.dimensions;if(dimensions){params.append("dimensions",JSON.stringify(dimensions))} var userDimensions=sentinelObject.userDimensions;if(userDimensions){params.append("userDimensions",JSON.stringify(userDimensions))}} var utmCookie=this.getCookieValue(this.utmDataCookieName);if(utmCookie){utmCookie=JSON.parse(decodeURIComponent(utmCookie));if("utm_campaign" in utmCookie){params.append("utm_campaign",utmCookie.utm_campaign)} if("utm_medium" in utmCookie){params.append("utm_medium",utmCookie.utm_medium)} if("utm_source" in utmCookie){params.append("utm_source",utmCookie.utm_source)}} params.append("category",category);params.append("type",type);params.append("typeValue",typeValue);params.append("uuid",this.uuid);params.append("isEvent",1);var xhttp=new XMLHttpRequest();xhttp.open("GET",`${url}?${params.toString()}`,!0);xhttp.send()};senp1.prototype.getConnectionSpeed=function(){var connectionSpeed=null;if(navigator.connection){connectionSpeed=navigator.connection.downlink} return connectionSpeed};senp1.prototype.sendFtPl=function(){if(this.sendPings){var timestamp=this.extractKeyValue("footerTimestamp")||Date.now();this.sendPl(timestamp,"footerPing",timestamp)}};senp1.prototype.checkForGA=function(){var self=this;setTimeout(function(){self.checkForGATest()},3000)};senp1.prototype.checkForGATest=function(){if(typeof window.gtag==='function'){if(window.dataLayer){let gtmDOM=window.dataLayer.some((entry)=>{if('event' in entry){return entry['event']==='gtm.dom'}});if(!gtmDOM){var timestamp=Date.now();this.sendPl(timestamp,"isGATrackerBlocked",1)}}else{var timestamp=Date.now();this.sendPl(timestamp,"isGATrackerBlocked",1)}}};senp1.prototype.executeWithProbability=function(probability,callback){if(Math.random()<=probability){callback()}};senp1.prototype.injectFooterJs=function(){var footerJs=document.createElement('script');footerJs.textContent=`if(window.websiteSentinel) { window.websiteSentinel.sendFtPl(); window.websiteSentinel.trackUserMetrics(); } //Check for GA on pageLoad after GA has tried to load window.onload = function() { if (window.websiteSentinel && !0) { window.websiteSentinel.checkForGA(); }else { window.websiteSentinel.logError('Skipped adBlock check') } };`;if(!this.extractKeyValue("footerTimestamp")){window.addEventListener('DOMContentLoaded',()=>{this.appendToFooter(footerJs)})}else{this.appendToFooter(footerJs)}};senp1.prototype.setupUtmDataCookie=function(name){let utmData=this.getUTMParamsFromUrl();this.setCookie(name,utmData,this.lifetimeDuration)};senp1.prototype.setupCookies=function(){var currentSession=this.checkSessionCookie();if(currentSession===null){this.createSessionCookie()} document.addEventListener("mousemove",()=>{this.debouncedResetTimer()});document.addEventListener("keypress",()=>{this.debouncedResetTimer()})};senp1.prototype.createSessionCookie=function(){var sessionId=this.generateSessionId();var active=new Date().toISOString();this.setCookie("sentinelbi_session",{session_id:sessionId,last_active:active},this.sessionDuration);return sessionId};senp1.prototype.generateSessionId=function(){return'sess-'+Math.random().toString(36).substr(2,9)+'-'+new Date().getTime()};senp1.prototype.debouncedResetTimer=function(){clearTimeout(this.debounceResetTimer);this.debounceResetTimer=setTimeout(()=>{this.resetSessionTimer()},500)};senp1.prototype.resetSessionTimer=function(){var currentSession=this.checkSessionCookie();if(currentSession===null){this.createSessionCookie()}else{const lastActive=new Date(currentSession.last_active).getTime();const currentTime=new Date().getTime();var sessionId=this.getCookieValueByKey("sentinelbi_session","session_id");var active=new Date().toISOString();if((currentTime-lastActive)>this.sessionDuration){sessionId=this.generateSessionId()} this.setCookie("sentinelbi_session",{session_id:sessionId,last_active:active},this.sessionDuration)}};senp1.prototype.checkSessionCookie=function(){var sessionCookie=this.getCookieValue("sentinelbi_session");if(sessionCookie!==null){return JSON.parse(decodeURIComponent(sessionCookie))} return null};senp1.prototype.setCookie=function(name,sessionObject,msToExpire){if(typeof sessionObject!=='object'||sessionObject===null){return} const value=encodeURIComponent(JSON.stringify(sessionObject));const expires=new Date();expires.setTime(expires.getTime()+msToExpire);document.cookie=`${name}=${value}; expires=${expires.toUTCString()}; path=/; SameSite=Strict; Secure`};senp1.prototype.getCookieValue=function(name){var cookies=document.cookie.split("; ");for(let cookie of cookies){var[key,value]=cookie.split("=");if(key===name)return decodeURIComponent(value);} return null};senp1.prototype.getCookieValueByKey=function(name,key){var cookie=this.getCookieValue(name);if(!cookie){return null} var parsedObject=JSON.parse(decodeURIComponent(cookie));return parsedObject[key]!==undefined?parsedObject[key]:null};senp1.prototype.appendToFooter=function(script){var footer=document.querySelectorAll('footer')[document.querySelectorAll('footer').length-1];if(footer){footer.appendChild(script)}else{document.body.appendChild(script)}};senp1.prototype.trackUserMetrics=function(){var maxEngagedDepth=0;var engagedSecondsStartTime=Date.now();let sentinelObject=this.extractKeyValue("config");if(sentinelObject.customTrackingContainer===undefined||(sentinelObject.customTrackingContainer==='body'||document.querySelector(sentinelObject.customTrackingContainer)===null)){element=document.body}else{element=document.querySelector(sentinelObject.customTrackingContainer)} let elementStartPos=element.getBoundingClientRect().top+document.documentElement.scrollTop;window.addEventListener("scroll",()=>{let scrolled=window.scrollY+window.innerHeight;var scrolledPos=(scrolled/(element.offsetHeight-elementStartPos))*100;if(scrolledPos>maxEngagedDepth&&maxEngagedDepth<100){maxEngagedDepth=scrolledPos}});window.addEventListener('beforeunload',function(){window.websiteSentinel.sendEngagementData(engagedSecondsStartTime,maxEngagedDepth,'beforeunload')});window.addEventListener('pagehide',function(){window.websiteSentinel.sendEngagementData(engagedSecondsStartTime,maxEngagedDepth,'pagehide')});window.addEventListener('visibilitychange',function(){if('visible'===document.visibilityState){return} window.websiteSentinel.sendEngagementData(engagedSecondsStartTime,maxEngagedDepth,'visibilitychange')});setTimeout(function(){window.websiteSentinel.sendEngagementData(engagedSecondsStartTime,maxEngagedDepth,'timer')},3600000)};senp1.prototype.getUTMParamsFromUrl=function(){const currentUrl=window.location.href;const urlParams=new URLSearchParams(new URL(currentUrl).search);const utms=['utm_source','utm_medium','utm_campaign','utm_term','utm_content'];let utmData={};utms.forEach(param=>{if(urlParams.has(param)){utmData[param]=urlParams.get(param)}});return utmData};senp1.prototype.extractKeyValue=function(key){var sentinelData=(!window.sentinelData)?window.sentinel:window.sentinelData;if(!sentinelData||!sentinelData.length){return undefined} const pair=sentinelData.find(([k,v])=>k===key);return pair?pair[1]:undefined};senp1.prototype.generateUUID=function(){var uuid;if(typeof crypto.randomUUID==='function'){uuid=crypto.randomUUID()}else{function fallbackUUID(){return'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g,function(c){var r=Math.random()*16|0,v=c==='x'?r:(r&0x3|0x8);return v.toString(16)})} uuid=fallbackUUID()} return uuid};senp1.prototype.isNullOrEmptyOrUndefined=function(value){return value==null||value===""};senp1.prototype.logError=function(message){console.error(`[SentinelBI Error]: ${message}`)};window.senp1=senp1;window.websiteSentinel=new senp1();window.websiteSentinel.injectFooterJs()