function drawABTest(ratio) { const random = Math.floor(Math.random() * 100); return random < ratio; } (function () { const queryString = window.location.search; const urlParams = new URLSearchParams(queryString); const opti_param_value = urlParams.get("ab_opti_pbstck"); const ab_test = drawABTest(50); if (ab_test || opti_param_value === "opti") { // Opti Digital const pubid = "46980923"; const script = document.createElement("script"); script.type = "text/javascript"; script.async = true; script.src = `https://optiyield.opti-digital.com/pfc/?pubid=${pubid}`; const meta = document.createElement("meta"); meta.name = "ad:ab_opti_pbstck"; meta.content = "opti"; document.head.appendChild(script); document.head.appendChild(meta); } else if ( !ab_test || opti_param_value === "pbstck"){ // Pubstack const meta = document.createElement("meta"); meta.name = "ad:ab_opti_pbstck"; meta.content = "pbstck"; document.head.appendChild(meta); } })();