Skip to main content
Contributor ⭐️⭐️
May 20, 2025 2:28 PM UTC
Solved

Get user object on site load

Hi everyone, could you please tell me how I can retrieve the user object when the site loads? I'm particularly interested in displaying the user's email in the UI. Is this possible, and how can it be implemented? Thanks in advance!

olimarrio
olimarrioAnswer
Gainsight Employee ⭐️
May 21, 2025 10:49 AM UTC

​@jvdc exactly right it’s a security issue to include the email address in this object.

​@Vadym the following answer to this question provides a workaround of how you can achieve this:

Thanks!

6 replies

Kenneth R
Expert ⭐️⭐️
May 20, 2025 2:40 PM UTC

Hey ​@Vadym - I think the best place for you to start is probably the inSidedData Object:

It won’t give you the email address natively, but it will give you the ID and username of the visitor.

Translate
VadymAuthor
Contributor ⭐️⭐️
May 20, 2025 2:50 PM UTC

Hey ​@Vadym - I think the best place for you to start is probably the inSidedData Object:

It won’t give you the email address natively, but it will give you the ID and username of the visitor.

Hi, thanks for the response! 🙃
I’ve looked into that object, but unfortunately it doesn’t provide access to the email.
I also tried making an API request, but I’m getting an error.
I’d really like to understand how to do this properly step by step 🤔

Translate
Kenneth R
Expert ⭐️⭐️
May 20, 2025 5:22 PM UTC

Gotcha ​@Vadym - building something like that is beyond my skills but hopefully someone more technical will chime-in.  :)

Translate
jvdc
Expert ⭐️
May 21, 2025 4:47 AM UTC

Hey, there is perhaps a data protection reason why you can't retrieve user email addresses like that, no?

Translate
olimarrio
Gainsight Employee ⭐️
olimarrioAnswer
Gainsight Employee ⭐️
May 21, 2025 10:49 AM UTC

​@jvdc exactly right it’s a security issue to include the email address in this object.

​@Vadym the following answer to this question provides a workaround of how you can achieve this:

Thanks!

Translate
VadymAuthor
Contributor ⭐️⭐️
May 21, 2025 12:22 PM UTC

​@olimarrio thanks a lot!

Translate