// Define a flag to track whether the UserWay script is loaded var userwayLoaded = false; // Define a function to load the UserWay script function loadUserWay() { if (!userwayLoaded) { var script = document.createElement("script"); script.setAttribute("data-account", "9unYHRbyX5"); script.setAttribute("src", "https://cdn.userway.org/widget.js"); (document.body || document.head).appendChild(script); // Append the script to the document's or section document.head.appendChild(script); // Set the flag to true userwayLoaded = true; // Remove the event listeners window.removeEventListener('scroll', loadUserWay); window.removeEventListener('mousemove', loadUserWay); } } // Wait until the DOM is fully loaded before adding the event listeners document.addEventListener('DOMContentLoaded', function() { // Add event listeners to the window object that listen for user interaction window.addEventListener('scroll', loadUserWay); window.addEventListener('mousemove', loadUserWay); });