PageSourceSearch

https://www.vdvelde.com/wp-content/plugins/profitmetrics/assets/js/pmTPTrack.min.js?ver=3.7.4

js vdvelde.com collected 2026-10-08 10:21:46 UTC 14,369 bytes, 1 lines download raw bytes

1!function(){"use strict";function t(){try{const t=localStorage.getItem(v);if(!t)return null;const n=JSON.parse(t),e={};return n&&!1===n.statistics&&(e.statistics=!1),n&&!1===n.marketing&&(e.marketing=!1),Object.keys(e).length?e:null}catch(t){return null}}function n(t,n){if(!S)return;const e="ProfitMetrics: "+t;n?console.log(e,n):console.log(e)}function e(t,n){return"string"==typeof t&&n.some(function(n){return t.startsWith(n)})}function i(t){return T.get(t)||null}function s(t){try{return decodeURIComponent(t)}catch{return t||""}}function o(t){return(t||"").trim()}function a(t){if(!t)return null;const n=o(t).split(".");if(n.length>=3){const t=n[2],e=t.indexOf("$");return e>-1?t.substring(0,e):t}return null}function c(t){if(!t)return null;const n=s(o(t)),e=n.indexOf("k"),i=n.indexOf("$",e);return-1!==e&&i>e+1?n.substring(e+1,i):null}function r(t){if(!t)return{sessionId:null,sessionCount:null};const n=t.indexOf(".");if(-1===n)return{sessionId:null,sessionCount:null};const e=t.substring(0,n);if("GS1"===e){const n=t.split(".");return{sessionId:n[2]||null,sessionCount:n[4]||null}}if("GS2"===e){const e=t.indexOf(".",n+1);
1if(-1===e)return{sessionId:null,sessionCount:null};const i=t.substring(e+1).replace(/%24/g,"$").split("$"),o={sessionId:null,sessionCount:null};for(let t=0;t<i.length;t++){const n=i[t];if(n.length>1){const t=n[0],e=n.substring(1);"s"===t?o.sessionId=s(e):"o"===t&&(o.sessionCount=s(e))}}return o}return{sessionId:null,sessionCount:null}}function l(t){return!("string"!=typeof t||t.length<4)&&(t.startsWith("GS1.")||t.startsWith("GS2.")||/^GS\d\./.test(t))}function u(t){if("string"!=typeof t)return null;const n=t.indexOf("_ga_");if(-1===n)return null;const e=t.slice(n+4);if(!e)return null;const i=e.split("_"),s=(i[i.length-1]||"").trim();if(!s)return null;const o=s.toUpperCase();return/^(?:G|GA4|GT)-[A-Z0-9]+$/.test(o)||/^[A-Z0-9]{6,}$/.test(o)?o:null}function d(){if(!0!==M.statistics)return{ga4SessionId:null,ga4SessionCount:null};if(null===P&&O._updateCache(),null===I||void 0===I.sessionIds){I={sessionIds:[],sessionCounts:[]};for(const[t,n]of Object.entries(P)){if(!l(n))continue;const e=u(t);if(!e)continue;const i=r(n);i.sessionId&&I.sessionIds.push(e+":"+i.sessionId),i.sessionCount&&I.sessionCounts.push(e+":"+i.sessionCount)}}return{ga4SessionId:I.sessionIds.join(",")||null,ga4SessionCount:I.sessionCounts.join(",")||null}}function g(){const t=i("gclid");return t||(!0!==M.marketing?null:a(O.get("_gcl_aw"))||c(O.get("FPGCLAW"))||null)}function f(){const t=i("gbraid");return t||(!0!==M.marketing?null:c(O.get("_gcl_ag"))||c(O.get("FPGCLAG"))||null)}function p(){const t=i("wbraid");return t||(!0!==M.marketing?null:a(O.get("_gcl_gb"))||c(O.get("FPGCLGB"))||null)}function m(){const t=Date.now();if(G.data&&t-G.timestamp<100)return G.data;const e=O.get(y);let i;if(e)try{i=JSON.parse(decodeURIComponent(e)),n("Processing tracking data from cookie",i)}catch(t){n("Failed to parse tracking cookie"),i=null}return i||(n("No tracking cookie found; returning default state"),i={gclid:null,gacid:null,gacid_source:null,fbp:null,fbc:null,gbraid:null,wbraid:null,sccid:null,ttclid:null,msclkid:null,twclid:null,ga4SessionId:null,ga4SessionCount:null,cc_statistics:!1,cc_marketing:!1}),G.data=i,G.timestamp=t,i}function h(t,e){e||(e=m());let i=!1;const s={...e};for(const[n,e]of Object.entries(t))if(null!=e&&s[n]!==e){if("gatracker"===s.gacid_s
1ource&&"gacid"===n&&"gatracker"!==t.gacid_source)continue;if("gatracker"===s.gacid_source&&"gacid_source"===n&&"gatracker"!==e)continue;s[n]=e,i=!0}return i&&(s.timestamp=Math.floor(Date.now()/1e3),function(t){const e=Object.fromEntries(Object.entries(t).filter(([,t])=>null!==t).sort(([t],[n])=>t.localeCompare(n)));if(!Object.keys(e).some(t=>"timestamp"!==t&&void 0!==e[t]))return void n("Skipping cookie write; no data to save");const i=encodeURIComponent(JSON.stringify(e));document.cookie=y+"="+i+"; path=/; max-age=7776000",n("Saved tracking data to cookie",e),G.data=null,G.timestamp=0,P=null}(s)),{data:s,changed:i}}function k(){if(!window._pmt||window.headlessMode)return;const t=Date.now();t-j<1500||(j=t,fetch(window._pmt,{credentials:"same-origin",keepalive:!0}).catch(function(){}))}function w(){if("function"==typeof wp_has_consent){const t={statistics:wp_has_consent("statistics")||wp_has_consent("analytics"),marketing:wp_has_consent("marketing")||wp_has_consent("advertising")};return n("Checked WP Consent API status",t),t}return null}function _(){if(window.google_tag_data?.ics?.entries){const{entries:t}=window.google_tag_data.ics,e=t=>{if(t&&(!1!==t.default||!1!==t.update||!0!==t.implicit))return void 0!==t.update?t.update:t.initial},i=e(t.analytics_storage),s=e(t.ad_storage);if(void 0!==i||void 0!==s){const t={statistics:"granted"===i||!0===i,marketing:"granted"===s||!0===s};return n("Checked Google Consent Mode status",t),t}n("Google Consent Mode detected but no consent decisions made yet")}return null}function C(t,e){const i=!!t,s=!!e;void 0===t&&void 0===e||(M.statistics!==i||M.marketing!==s?(function(t,n){try{const e={};!1===t&&(e.statistics=!1),!1===n&&(e.marketing=!1),Object.keys(e).length?localStorage.setItem(v,JSON.stringify(e)):localStorage.removeItem(v)}catch(t){}}(t,e),n("Processing consent change",{statistics:i,marketing:s}),M={statistics:i,marketing:s},i||s?(n("Triggering main initialization; consent granted"),O.refreshCache(),init(m(),{cc_statistics:i,cc_marketing:s}),k()):h({cc_statistics:i,cc_marketing:s},m())):n("Skipping consent update; state unchanged"))}function init(t,e){n("Starting main initialization");const{ga4SessionId:s,ga4SessionCount:o}=d();h({...e||{},fbc:O.get("_fbc"),fbp:O.get("_fbp"),gacid:O.get("_ga"),gacid_source:O.get("_ga")?"gacookie":null,gclid:g(),gbraid:f(),wbraid:p(),sccid:i("sccid"),ttclid:i("ttclid"),msclkid:i("msclkid"),twclid:i("twclid"),ga4SessionId:s,ga4SessionCount:o},t)}function b(){return!!window.google_tag_data?.ics?.addListener&&(n("Registering GCM listener"),window.google_tag_data.ics.addListener(["ad_storage","analytics_storage"],R),!0)}const y="pmTPTrack",S=Boolean(window.pmDebugEnabled),v="pmcd";let P=null,I=null,G={data:null,timestamp:0},M={statistics:!1,marketing:!1};const O={get(t){return null===P&&this._updateCache(),P[t]||null},getAll(){return null===P&&this._updateCache(),P},refreshCache(){this._updateCache()},_updateCache(){n("Parsing document.cookie (CookieManager)"),P={};const t=document.cookie;if(!t)return;const e=t.split(";");for(let t=0;t<e.length;t++){const n=e[t],i=n.indexOf("=");if(-1===i)continue;const s=n.substring(0,i).trim();P[s]=n.substring(i+1)}}},T=new URLSearchParams(window.location.search),A=["G-","GA4-","GT-"],L=["AW-","DC-"];let j=0;const R=()=>{n("GCM listener triggered - processing consent update");const t=_();if(t){const e=M.statistics,i=M.marketing;t.statistics!==e||t.marketing!==i?(n("GCM consent changed",{from:{
1statistics:e,marketing:i},to:{statistics:t.statistics,marketing:t.marketing}}),C(t.statistics,t.marketing)):n("GCM listener fired but consent unchanged")}else n("GCM listener fired but no consent decisions available")};b()&&(window.pmTPTrackGCMRegistered=!0),window.addEventListener("DOMContentLoaded",function(){n("DOMContentLoaded event detected");const t={wp_listen_for_consent_change:{handler:t=>{n('Handling "wp_listen_for_consent_change" event');const e=t.detail||{};let{statistics:i,marketing:s}=M;for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t)){const n="allow"===e[t];["statistics","analytics"].includes(t)?i=n:["marketing","advertising"].includes(t)&&(s=n)}C(i,s)}},wp_consent_type_defined:{handler:()=>{n('Handling "wp_consent_type_defined" event');const t=w();t&&C(t.statistics,t.marketing)}}};for(const[e,i]of Object.entries(t))n('Adding listener for "'+e+'"'),(i.target||window).addEventListener(e,i.handler);!window.pmTPTrackGCMRegistered&&b()&&(window.pmTPTrackGCMRegistered=!0);let e=!1;n("Processing initial CMP checks"),w()&&!window.google_tag_data?.ics&&n("WARNING: WordPress Consent API detected without Google Consent Mode integration. Consider using a GCM-compatible consent provider for better tracking accuracy.");const i=[w,_];for(const t of i){const i=t();if(i){n("Consent state determined by CMP on initial check"),C(i.statistics,i.marketing),e=!0;break}}e||n("No consent determined by CMP; relying on early consent or keeping denied state"),S&&(n("Persisting debug state with link click."),document.addEventListener("click",function(t){const e=t.target.closest("a");if(e&&e.href&&!["javascript:","mailto:","tel:"].includes(e.protocol)&&!e.getAttribute("href").trim().startsWith("#"))try{const t=new URL(e.href);if(t.searchParams.has("pmdebug"))return;t.searchParams.set("pmdebug","true"),e.href=t.toString()}catch(t){n("Could not modify link href: "+e.href,t)}}))});const x=(()=>{let t=new Set,e=!1,i=null,s=null;const o=(t,o)=>{if(!e&&(e=!0,i&&(clearTimeout(i),i=null),n("Purchase signal watcher settled",{value:t,meta:o}),"function"==typeof s))try{s(t??!1,o)}catch(t){n("Purchase signal watcher callback failed",t)}};return{start(a,c,r){t=new Set,e=!1,i&&(clearTimeout(i),i=null),s=null,s=r;const l=Array.isArray(a)?a.map(t=>String(t)).filter(t=>t.length>0):[];if(0===l.length)return n("Purchase signal watcher detected no destinations; defaulting to false"),void o(!1,{reason:"no-events"});l.forEach(n=>t.add(n));const u="number"==typeof c&&c>=0?c:3500;n("Purchase signal watcher started",{expected:l,timeout:u}),i=setTimeout(()=>o(!1,{reason:"timeout"}),u)},markSuccess(i,s="event_callback"){if(e)return;const a=String(i);t.has(a)&&(n("Purchase signal destination succeeded",{destination:a,via:s}),o(!0,{reason:"success",destination:a,via:s}))}}})();window._pmStartPurchaseWatch=function(t,n,e){x.start(t,n,e)},window._pmNotePurchaseSuccess=function(t,n="event_callback"){x.markSuccess(t,n)},window.pmTPTrack={init,onGtmCallback:function(t,i){O.refreshCache(),I=null;const s="string"==typeof t?t.trim():"",o=s.length>0&&"function"==typeof gtag,a=o&&e(s,A),c=o&&e(s,L);if(n("Processing tracking data after Google callback",{trackingId:s||"unknown",hasClientId:"string"==typeof i&&i.length>0}),!0!==M.statistics&&!0!==M.marketing)return void n("Skipping GTM callback; no consent granted");const{ga4SessionId:r,ga4SessionCount:l}=d(),u={gacid:O.get("_ga"),gacid_source:O.get("_ga")?"gacookie":null,gclid:g(),gbraid:f(),wbraid:p(),ga4SessionId:r,ga4SessionCount:l};(!u.gacid||0===u.gacid.length)&&"string"==typeof i&&i.length>0&&(u.gacid=i,u.gacid_source="gatracker");let m=0;const w=function(){0===m&&h(u).changed&&k()},_=function(t,e,i){if(!o)return;m+=1;let a=!1;const c=setTimeout(function(){a||(n("gtag.get request timed out",{trackingId:s,field:t}),a=!0,m=Math.max(0,m-1),w())},2e3),r=function(t){if(!a){if(a=!0,clearTimeout(c),null!=t&&!u[e]){const n=i?i(t):t;null!=n&&""!==n&&(u[e]=n)}m=Math.max(0,m-1),w()}};n("Requesting value via gtag.get",{trackingId:s,field:t});try{gtag("get",s,t,function(t){r(t)})}catch(e){n("gtag.get request failed",{trackingId:s,field:t,error:e&&e.message?e.message:e}),r(void 0)}};!u.ga4SessionId&&a&&_("session_id","ga4SessionId",function(t){const n=String(t||"").trim();return n?s+":"+n:null}),!u.ga4SessionCount&&a&&_("session_number","ga4SessionCount",function(t){const n=String(t||"").trim();return n?s+":"+n:null}),!u.gclid&&!0===M.marketing&&c&&_("gclid","gclid",function(t){return String(t||"").trim()||null}),w()},checkConsent:function(){n("Manual consent check triggered");const t=_();t?t.statistics!==M.statistics||t.marketing!==M.marketing?C(t.statistics,t.marketing):n("Manual consent check; no state changes detected"):n("Manual consent check;
1 no GCM consent decisions found")},logGtag:function(t){"string"==typeof t&&0!==t.length&&(n("Gtag invoked",{event:t}),window.dataLayer=window.dataLayer||[],Array.isArray(window.dataLayer)&&window.dataLayer.push({event:"pm_signal",call:t}))},sendOrderSignal:async function(t,e,i=null){if(!t||!e)return void n("Order signal skipped; missing required parameters");const s=m(),o=s.cc_statistics??M.statistics??null,a=s.cc_marketing??M.marketing??null,c=t=>!0===t?"true":"false",r=n=>{const s=[["pid",t],["primaryTransactionId",e]];return null!=i&&s.push(["cb2SignalValue",c(i)]),null!=o&&s.push(["ccStatistics",c(o)]),null!=a&&s.push(["ccMarketing",c(a)]),`${n}?${s.map(([t,n])=>`${t}=${encodeURIComponent(n)}`).join("&")}`},l=t=>{if("object"==typeof navigator&&"function"==typeof navigator.sendBeacon)try{return navigator.sendBeacon(t,"")}catch(t){return n("Order signal beacon failed",t),!1}return!1},u=async t=>{if("function"!=typeof fetch)return!1;try{const e=await fetch(t,{method:"POST",headers:{"Content-Type":"text/plain"},body:"",keepalive:!0});return!!e.ok||(n("Order signal fetch failed; HTTP status "+e.status),!1)}catch(t){return n("Order signal fetch failed",t),!1}},d=r(window.signalEndpoint||"https://cbsignal-1.in-endp.profitmetrics.io/in/v1/signal"),g=r("https://edgeboost.profitmetrics.io");try{if(await u(d))return void n("Order signal sent; primary fetch");if(await u(g))return void n("Order signal sent; fallback fetch");if(l(g))return void n("Order signal sent; fallback beacon");if(l(d))return void n("Order signal sent; primary beacon");n("Order signal failed; all endpoints exhausted")}catch(t){n("Order signal failed",t)}}},function(){const e=void 0!==window.CookieConsent||void 0!==window.Cookiebot||"function"==typeof window.wp_has_consent||"function"==typeof window.__tcfapi||void 0!==window.UC_UI||window.google_tag_data&&window.google_tag_data.ics,i=m()||{},s=!0===i.cc_statistics,o=!0===i.cc_marketing;if(e)if(n("CMP detected on early check"),!0===window.blockScriptBeforeConsent)s||o?(n("Restoring previous consent from cookie (CMP present)"),C(s,o)):n("No previous consent in cookie; waiting for CMP consent decision");else{const e=null!==O.get(y),i=t();!e&&i?n("Durable denial found in localStorage; skipping optimistic grant (CMP present)"):(n("Granting consent immediately (blockScriptBeforeConsent is false, CMP present)"),C(!0,!0))}else if(n("No CMP detected on early check; checking consent settings"),!0===window.blockScriptBeforeConsent)s||o?(n("Restoring previous consent from cookie"),C(s,o)):n("No previous consent found; keeping denied state");else{const e=null!==O.get(y),i=t();!e&&i?n("Durable denial found in localStorage; skipping optimistic grant"):(n("Granting consent immediately (blockScriptBeforeConsent is false)"),C(!0,!0))}}()}();

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.