How to save ui_locales to user metadata in a Pre User Registration hook

is there a way to save the ui_locales passed to the register screen to a user’s metadata?

I was trying to use a Pre User Registration hook however I seem unable to address the ui_locales, or any other way to pass a variable.

found it, so posting it here for people searching for the same answer:

exports.onExecutePreUserRegistration = async (event, api) => {
   api.user.setUserMetadata("country", event.request.geoip.countryCode); 
      api.user.setUserMetadata("lang ", event.transaction.ui_locales[0]);

1 Like

Thank you a lot for sharing it with the rest of community!