Is it possible to collect IP addresses in a hidden Webflow form?

Published on
September 22, 2023

Yes, it is possible to collect IP addresses in a hidden Webflow form by utilizing custom code. Here's a step-by-step guide on how to achieve this:

  1. Create a hidden field in your Webflow form: In the form settings, add a new field and set its type to "Hidden". This field will hold the value of the visitor's IP address.

  2. Add custom code to capture the IP address: Go to the page where the form is located, and click on the "Page Settings" icon in the top-right corner. In the Custom Code section, select the Footer tab.

  3. Insert the custom code to capture the IP address: Insert the following JavaScript code into the Footer Custom Code section:

    ```javascript

    ```

    This code uses the fetch API to make a request to an IP lookup service (in this case, https://api.ipify.org). The response contains the visitor's IP address, which is then assigned to the hidden field with the ID ip-address.

  4. Update your form submission actions: In the form settings, under the Actions tab, configure the form submission actions as desired (e.g., send an email notification, save to a database, etc.).

That's it! When a visitor submits the form, an additional field will be included with their IP address.

Please note that collecting IP addresses may have legal and privacy implications, so it's important to ensure compliance with applicable laws and regulations.

Additional Questions:

  1. How can I hide a field in a Webflow form?
  2. Can I customize the form submission actions in Webflow?
  3. Are there any legal considerations when collecting user data, including IP addresses, in Webflow?