Getting UserAgent and User IP values

Hi, I got this code on my contact us page:

export function contactus_wixFormSubmitted() { 
  fetch("https://hook.integromat .com/ia4ods8mtxzg6jkvknb2n854q", {
    "method": "post",
    "headers": {
      "Content-Type": "application/x-www-form-urlencoded"

It has 2 main goals:

  1. Gathering hidden fields about the session, for example, the first full url the user visited (saved in the local storage, including the queries), the current page’s title and url, etc…

  2. Send these values along with the form input fields values as an HTTP request to an Integromat webhook I have.

I want to have the userAgent value populated instead of the “UserAgentValue”, and the remote ip value instead of the “”.

How can I achieve this?
Thanks in advance :slight_smile:

The Ip-address can be fetched using . There are even some examples here on this forum, search.
It does not return the ua, but I found, which does. So yes, it means 2 calls. I couldn’t find one which does it all in one, but maybe you can.

I can actually see in Wix’s documentation that there is a way to capture both of those values without using external libraries and APIs.

I’m just not sure how to use it correctly:

@admin81489 Yes, but that is for router pages. You can setup one, I do not know if that would work for you.
BTW, there also another possibility: put a small, invisible html-component on page, retrieve info there in plain html and postMessage it back to the Wix page.

@giri-zano I started looking into the postMessage option.
I can use Google Tag Manager to get all of these relevant values pretty easily, and then use an HTML tag to push these values to the page.
I’m not sure how I can achieve this.
I would need to use a regular javascript syntax to send the postMessage, and then use Velo to listen to message and somehow save these values.

I’m gonna need some help with that.

@admin81489 Just by clicking the right “Similar Posts” pane, I found this:

I was able to retrieve the user agent very easily, using this code:


I was able to solve both!
To get the user agent, you just need to use: navigator.userAgent

To get the IP address, you need to use extreme-ip-lookup API.
This is fairly easy.
1st step is to fetch it from the API:

$w.onReady(function () {
  fetch('https://extreme-ip-lookup .com/json', {
      method: 'get'
    .then((httpResponse) => {
      if (httpResponse.ok) {
        return httpResponse.json();
    .then((json) => {
      const ipaddress = json.query;

Then, you just need to use the “ipaddress” constant to get the value.