I thinked a lot before implementing this and I would like to avoid javascript too, but I do not know another way of capturing the moment when the user wants to log out from moodle without modifing moodle core, or writing a moodle plugin, the idea here was not to touch moodle, only let question2answer do de magic. The only way I found was attaching an event listener to the moodle logout link, but perhaps in the future there is a better way to do that, and if anyone knows how let us know. I made an "best effort" approach because I try to logs out the user from q2a when he tries to logs out from moodle, but I do not block him if the ajax calls fails, I always redirect to moodle log out link:
 .always(function() {
        window.parent.location.replace(logout_url);
 });