Redirect Users on Logout

Is there an easy way to redirect users back to a specific page upon logout? Right now, I use the following:

$(document).on("knack-view-render.view_****", function (event, view, data) { // Login Page to Redirect
  window.location.replace("**destination**"); // Destination Page
});

This works, but I have to have this full code for each and every login page. Is there another option I can use that will allow me to not have to repeat this over and over again?

Thanks!

I use this redirect

/* Change the scene_1 to the scene key of your choice, or replace with any to work on all pages. */
$(document).on(‘knack-scene-render.scene_#’, function(event, scene, data) {
$(“a.kn-log-out”).on(“click”, function() {
// Some browsers need some wait-time to finish the logout
setTimeout(function(){
// replace with your desired URL
window.location = “URL-GOES-HERE”;
}, 500);
})
});

I used Pieter’s solution until I noticed today that it’s not working.

try below

$(document).on(“knack-view-render.view_any”, function (event, view, data) { // Login Page to Redirect
if(Knack.getUserAttributes().id==undefined)
location.href=’#home’;
});