How to do an API hit with the visitor's IP address with SSR?

Question:
I want to display the visitor’s city name based on their IP address. I need it done in SSR because onReady is too slow.
Product:
Wix Editor

What are you trying to achieve:
So basically :

  • visitor lands the website
  • wix server knows the IP address, does an API hit to another system with the visitor’s IP address as the input, and the city name as the output of the API hit
  • Once the city name is returned, wix server renders the city name
  • wix server returns the html to the browser already with the city name rendered in the html

What have you already tried:
I’ve tried many many iteration of ChatGPT (LOL), it started to turn in circles. It tried to get me to fetch the data, and then store into the collection, and the SSR replacing the city name into the content. However, the fetch or storing into the collection never ended up working, it kept on loading what I hardcoded into the collection.

Additional information:
I am absolutely new to wix, and especially the coding side of things, it looks like it’s using velo? Please provide me a functional example if possible. I’m trying to help out my friend with his project, but end up not really able to help him so far.