# Detect if user is logged in

**URL:** <https://community.hubspot.com/t/detect-if-user-is-logged-in/77274>\
**Category:** CMS Development\
**Tags:** professional\
**Created:** [March 15, 2023, 9:24pm UTC](https://community.hubspot.com/t/detect-if-user-is-logged-in/77274 "2023-03-15T21:24:06Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![danbraun](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/danbraun/32/76793_2.png) [@danbraun](https://community.hubspot.com/u/danbraun)\
**Post date:** [March 15, 2023, 9:24pm UTC](https://community.hubspot.com/t/detect-if-user-is-logged-in/77274/1 "2023-03-15T21:24:06Z")

</div>

Hi. I’d like to detect if a user visiting a page is logged in and conditionally run javascript based on this. I would like to apply this code in a module via design manager area.

Backgroud: Im trying to detect if one of our staff members is accessing the page from the Activities timeline, and prevent the auto submission of a form I have set up on that page if that is the case.

Is it possible to detect if the user is logged in? Thank you.

---

<div class="post-metadata">

**Author:** ![Jaycee\_Lewis](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/jaycee_lewis/32/61352_2.png) [@Jaycee\_Lewis](https://community.hubspot.com/u/Jaycee_Lewis)\
**Post date:** [March 16, 2023, 4:55pm UTC](https://community.hubspot.com/t/detect-if-user-is-logged-in/77274/2 "2023-03-16T16:55:53Z")

</div>

Hi, @danbraun 👋 Thanks for reaching out. Let’s see if our community members have tried to solve for this challenge or have any workarounds to suggest. Hey, @JBeatty @Anton [@Phil\_Vallender](https://community.hubspot.com/t5/user/viewprofilepage/user-id/74) @LMeert, do you have any suggestions for @danbraun?

Best,

Jaycee

---

<div class="post-metadata">

**Author:** ![johnphilipking](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/johnphilipking/32/40273_2.png) [@johnphilipking](https://community.hubspot.com/u/johnphilipking)\
**Post date:** [October 10, 2023, 7:49pm UTC](https://community.hubspot.com/t/detect-if-user-is-logged-in/77274/3 "2023-10-10T19:49:24Z")

</div>

I, too, am looking for the ability to detect an internal logged-in user on our production pages.

---

<div class="post-metadata">

**Author:** ![SanttuH](https://avatars.discourse-cdn.com/v4/letter/s/e480ec/32.png) [@SanttuH](https://community.hubspot.com/u/SanttuH)\
**Post date:** [May 5, 2023, 12:25pm UTC](https://community.hubspot.com/t/detect-if-user-is-logged-in/77274/4 "2023-05-05T12:25:52Z")

</div>

Hey, would love to know if there’s an anwser to this.  
Thanks
