Do you want details about a currently signed in user so that you can spawn integrations with third-party libraries? Some examples of this are:
- You want to add a third-party chat application to your page and their provided snippet requires you to supply it with a username and email address.
- You have a third-party analytics application and you want to send the current user's SSO ID to it to link users to your own information in your data warehouse.
The best way to do this is with the following Javascript:
window.onVanillaReady(function (vanilla) {
var user = vanilla.getCurrentUser()
});
This will fill the user
variable with an object filled with the current user's information. It's important that you put your code in the onVanillaReady
event handle to work with deferred script loading.
The information in this variable comes from the /api/v2/users/me
endpoint.
- Check out your Dashboard for more information on the fields there.
- Or, you can always call the endpoint from within your Dashboard to see a live sample.