Check if this code works for you:
Add to: Website tools > Code injection
<script>
(function() {
const idleDurationSecs = 20; // X number of seconds
const redirectUrl = ''; // ADD URL IN WICH YOU WANNA REDIRECT USERS es. yourpage.com/home
let idleTimeout; // variable to hold the timeout, do not modify
const resetIdleTimeout = function() {
// Clears the existing timeout
if(idleTimeout) clearTimeout(idleTimeout);
// Set a new idle timeout to load the redirectUrl after idleDurationSecs
idleTimeout = setTimeout(() => location.href = redirectUrl, idleDurationSecs * 1000);
};
// Init on page load
resetIdleTimeout();
// Reset the idle timeout on any of the events listed below
['click', 'touchstart', 'mousemove'].forEach(evt =>
document.addEventListener(evt, resetIdleTimeout, false)
);
})();
</script>
Hope this works
IF this works click the mark as solution button