I need to get the id of the user whose profile is being viewed. Do it for the birds!

I’m using wix members, and a database to track some things users have done. It’s essentially a birdwatching site. In the user profile page, I have a dataset I’m using to display images that user has taken.
Dataset is filtered by storing the url when you get to the profile you want to view. I’m getting the url, which contains the user id, and im filtering the dataset by the portion of the URL that is the user’s ID. This is hacky but I couldn’t find a universal way to store the user’s id of the profile whose being viewed. My method only works if the user’s profile was clicked straight from the forums or anywhere the link origin was already outside of the members pages. This is the only instance in which the profile url contains the users ID. For example, if you are already in the user’s profile section and you click the user’s forum posts and then go back to profile, it’s a different url and my method breaks.
Is there any api or any method at all I can use to get the Id of the user whose member’s section is currently being viewed? I will shower you with litecoin or perhaps dash.