function getQSParameterByName(e, n = window.location.href) { e = e.replace(/[\[\]]/g, "\\$&"); n = new RegExp("[?&]" + e + "(=([^&#]*)|&|#|$)").exec(n); return n ? n[2] ? decodeURIComponent(n[2].replace(/\+/g, " ")) : "" : null } function UpdateQueryString(e, n, r) { r = r || window.location.href; var l = new RegExp("([?&])" + e + "=.*?(&|#|$)(.*)", "gi"); if (l.test(r)) return null != n ? r.replace(l, "$1" + e + "=" + n + "$2$3") : (r = (t = r.split("#"))[0].replace(l, "$1$3").replace(/(&|\?)$/, ""), void 0 !== t[1] && null !== t[1] && (r += "#" + t[1]), r); if (null == n) return r; var t, l = -1 !== r.indexOf("?") ? "&" : "?"; return r = (t = r.split("#"))[0] + l + e + "=" + n, void 0 !== t[1] && null !== t[1] && (r += "#" + t[1]), r } function appendHitid() { try { var hitid = getQSParameterByName('hitid'); if (!hitid) { hitid = getQSParameterByName('hit'); } if (hitid) { options = document.getElementsByTagName("option"); if (options) { for (i = 0; i < options.length; i++) { if (options[i].value.includes('secure.nativepath.com')) { options[i].value = UpdateQueryString('cc_custom_hitid', hitid, options[i].value); }; } } if (options) { for (i = 0; i < options.length; i++) { if (options[i].value.includes('secure.tigermamasfoods.com')) { options[i].value = UpdateQueryString('cc_custom_hitid', hitid, options[i].value); }; } } links = document.links; if (links) { for (i = 0; i < links.length; i++) { if (links[i].href.includes('nativepath.com') || links[i].href.includes('tigermamasfoods.com')) { links[i].href = UpdateQueryString('cc_custom_hitid', hitid, links[i].href); links[i].href = UpdateQueryString('hit', hitid, links[i].href); }; } } } } catch (error) { console.error(error); } } document.addEventListener("DOMContentLoaded", function () { appendHitid(); });