# Trigger actions on user logout?

**URL:** <https://forums.knack.com/t/trigger-actions-on-user-logout/14770>\
**Category:** Get Answers\
**Created:** [August 24, 2023, 6:07am UTC](https://forums.knack.com/t/trigger-actions-on-user-logout/14770 "2023-08-24T06:07:57Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Calvin\_B](https://sea2.discourse-cdn.com/flex020/user_avatar/forums.knack.com/calvin_b/32/1897_2.png) [@Calvin\_B](https://forums.knack.com/u/Calvin_B)\
**Post date:** [August 24, 2023, 6:07am UTC](https://forums.knack.com/t/trigger-actions-on-user-logout/14770/1 "2023-08-24T06:07:57Z")

</div>

Hi,

Can we take actions on a user logout event?

In one of my apps, I have;

1. timers that are running assigned to users when they are working on various tasks. Works well, but sometimes users log outing go home and forget to stop their timers.
2. a timesheet section for clocking on and off. Again works well but users forget to clock off and just log out.

Wondering if anyone know a way of creating actions on an a logout event? Or even hijacking the logout button, so that i can do a getUserAttributes() to check for timers running and if they are have not clocked out and if so, message popup letting them know?

Thanks!

---

<div class="post-metadata">

**Author:** ![Arjun](https://sea2.discourse-cdn.com/flex020/user_avatar/forums.knack.com/arjun/32/4149_2.png) [@Arjun](https://forums.knack.com/u/Arjun)\
**Post date:** [August 28, 2023, 8:01am UTC](https://forums.knack.com/t/trigger-actions-on-user-logout/14770/2 "2023-08-28T08:01:27Z")

</div>

You can just use the following to perform a function before logout is completed. Use it for one of my clients where Login and Logouts are recorded and it works without any issues:

```auto
    $('.kn-log-out').on('click', function () {
        console.log(Knack.getUserAttributes().id);
    });

```
