Streaming live at 10am (PST)

How to track IP Address of people who fill out a form

Does anyone know how to collect the IP address of those who fill out form?

I have tried following these instructions bt so far its not working.

Here is the site.
https://preview.webflow.com/preview/vopalpha?utm_source=vopalpha&preview=bdc631b8774a5f605757dd9fbf821048

1 Like

What you need to do is:

  1. Make a form on your page
  2. Style it however you like and give it the inputs you need
  3. Make one more input, and give it an ID of ipFormInput in the Webflow designer
  4. Set this last field to hidden so that users don’t see it
  5. Copy this code into your page’s footer code:
<script type="application/javascript ">
    const ipFormInput = document.getElementById('ipFormInput');

    fetch('https://api.ipify.org?format=json')
        .then((response) => { return response.json() })
        .then((json) => {
            const ip = json.ip;
            ipFormInput.value = ip;
        })
        .catch((err) => { console.error(`Error getting IP Address: ${err}`) })
</script>

This script makes a call to an external service that returns the client’s IP address. It then sets the IP address as the value of the form field that has the ID ipFormInput. As long as you make this field hidden from the Webflow designer, the user will never see it. When the form is submitted you will get the IP address along with the other form fields.

I just wrote this and tested it, it works fine.

Hope that helps.
Jason

2 Likes

Hi Jason,

Thank you very much for your help. It hasn’t worked for me. Not sure what I am doing wrong.

https://preview.webflow.com/preview/vopalpha?utm_source=vopalpha&preview=bdc631b8774a5f605757dd9fbf821048

Regards
Dave

1 Like

Hi Jason,

I just got it working. Thanks heaps mate.

Much appreciated.

1 Like

Cool, glad it works for you!

Can collecting the IP address on a form get you blacklisted by ISP’s? I recently modified my forms to collect the IP address to help weed out fake submissions on my website. Almost overnight, we went from 5-6 form submissions per day to 0 submissions in almost 3 weeks! Within 4 days I had replaced the original forms that did not collect the IP address, but we are still receiving nothing.

1 Like

No. Web servers record IP address in the server logs on a visit anyway. You should look to see what the traffic sources were, and if that changed. Google analytics would be helpful for that.

Thanks for the reply!

Sweet, sounds simple. Does it have to be in the footer or could we put in the script of the contact form?

I tried to follow the instruction below and it did not work. So I decided to find a different solution. I have looked for an experienced developer in my area. We met and he did everything I need very quickly. Actually, he gave me some useful hints on some other things as well. Find a developer in your area by zip code, for this, postcode finder, please. It is really fast and convenient. At least, I prefer this approach.

Do these instructions still work when using https://www.ipify.org/ - I use Go High Level and can follow your instructions to the letter, but it’s not collecting the IP address and not entering any info on that field on the form.

What did you do to get it to work?