Get user_id for Javascript Function

I want to pull the currently logged in user’s User_id to populate a variable for a custom javascript function I’m running on a webpage. Is there a simple way to do this? I have seen/read the documentation around implementing the Intercom code, but it always references hard-coded user info, and I need to dynamically pull the info and can’t find the syntax to do so.
Thanks in advance for any help you can provide!

Welcome to the Forum!

I’d recommend checking out our developer documents which include an example of some syntax you can use in order to populate those variables dynamically. I’ll include a link to that particular setup here :point_down:

Thanks for the response. I’ve read that page (a few times now) and in every example, there is hard-coded user information in place. Perhaps I just missed it, but where do you see how to dynamically pull a user’s id?

No worries. The value for user_id should be automatically pulled once a user logs in. These variables would be pulled as long as you’ve set them into the code on your site like so:

If you would like to get in touch with someone on my team directly on this as well feel free to start a conversation with us through the Intercom Messenger on your Intercom workspace and we can take a look at your current setup!