Prevent cheating in quiz by submit quiz as soon as user leaves tab

Add this script in your wp-admin -> wplms -> footer -> google anaylitics script :

document.addEventListener("visibilitychange", function() {
if (document.hidden){
if(document.querySelector('.submit_quiz'))
document.querySelector('.submit_quiz').click();

} else {
console.log("Browser tab is visible")
}
});

Leave a Reply

Your email address will not be published. Required fields are marked *