1/** 2 * Affiliate tracking â reads ?ref=X or /ref/X/ from URL, sets cookies, 3 * fires AJAX visit record. 4 */ 5(function () { 6 if (typeof window.AFFWP === 'undefined') return; 7 var refVar = AFFWP.referral_var || 'ref'; 8 9 function qs(name) { 10 var m = window.location.search.match(new RegExp('[?&]' + name + '=([^&]+)')); 11 return m ? decodeURIComponent(m[1].replace(/\+/g, ' ')) : ''; 12 } 13 function pathSlug() { 14 var parts = window.location.pathname.split('/').filter(Boolean); 15 var idx = parts.indexOf(refVar); 16 return idx >= 0 && parts[idx + 1] ? parts[idx + 1] : ''; 17 } 18 function getCookie(name) { 19 var key = (AFFWP.cookie_prefix || '') + 'affwp_' + name + '='; 20 var parts = document.cookie.split(';'); 21 for (var i = 0; i < parts.length; i++) { 22 var c = parts[i].trim(); 23 if (c.indexOf(key) === 0) return decodeURIComponent(c.substring(key.length)); 24 } 25 return ''; 26 } 27 28 var slug = qs(refVar) || pathSlug(); 29 if (!slug) return; 30 31 /* Server handles resolution via template_redirect. This file is mostly a noop 32 * because all work happens server-side; we keep it loaded for future JS-only 33 * tracking scenarios (SPA integrations etc.). */ 34 // eslint-disable-next-line no-unused-expressions 35 void getCookie; 36})();
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.