// Create the script element const script = document.createElement('script'); // Set the attributes script.async = true; script.id = 'media-3744922'; script.type = 'text/javascript'; script.src = 'https://optvid.optmn.cloud/optvid-maariv.js'; // Determine the env value based on the host const host = window.location.hostname; const env = host.startsWith('m.') ? 'mw' : 'desktop'; script.setAttribute('env', env);script.setAttribute('autoplay', 'off'); // Append the script to the document's head document.currentScript.insertAdjacentElement('afterend', script); // Log the added script details (for debugging purposes) console.log(Script added with env: ${env});