WARNING: The notes here are not so much a solution, as a discussion of an approach that can be used. It is a very convoluted approach, and at this point, I wouldn't recommend it for use on any client site. You have been warned.
In our client-side Javascript, we want the UserID of the currently logged-in Memberships User.
It's not available [ 2023-07-13 ], anywhere. Not in script, not in any URL or HTML.
It is in a cookie, buried in an MD5-encoded JWT token, however that cookie is http-only which means our scripts cannot access it.
At present the Membership User _id is only exposed server-side, so you need to make that accessible client-side. For many, the most efficient approach is to duplicate that ID into a custom data field on that same User record.
Here's how to automate that process;
Webflow setup;
Automation setup;
* As of 2023-07-13, Logic unfortunately cannot be used in this situation, since it is unable to call the Webflow API.
Use Sygnal's User Info attributes to access the logged-in user's info, including those custom user fields.
You now have access to the ID.