How to capture geolocation in Gravity Forms
Gravity Forms can capture the submitter’s IP address natively, but it does not turn that address into reliable country, city or coordinate data by itself. Use a hidden field for the IP-only route, or use a geolocation add-on when you need location fields, maps or coordinates.
- 01Decide what location means
- 02Store the IP address manually
- 03Know the manual route’s limit
- 04Install a geolocation add-on
- 05Enable capture on the form
- 06Test accuracy and privacy
What you need
- A Gravity Forms form on WordPress
- Administrator access to WordPress
- A clear decision about IP location or precise coordinates
- A privacy notice covering location data
Decide what location means
First decide whether you need the submitter’s IP address, an approximate country or city, a typed address, or precise latitude and longitude. These are different data points. An IP address usually gives an approximate network location, while browser coordinates require permission and can be refused.
Do not describe IP-derived data as the visitor’s exact location. VPNs, mobile networks, proxies and business networks can make the result inaccurate.
Store the IP address manually
For the simplest manual route, edit the form and add a Hidden field. In its default value, enter the Gravity Forms merge tag {ip}, then save the form. Gravity Forms can use this value in a hidden field and the same merge tag can be used in notifications or confirmations.
This gives you the IP address, not a city, country or GPS position. Check the form entry after submitting a test entry. If IP storage has been disabled in your site’s personal-data settings, the value may be blank.
Know the manual route’s limit
Gravity Forms core does not provide a complete IP-to-location workflow. To turn the IP into location data manually, you would need custom server-side code or an external IP geolocation service, then map the returned values into fields or another system.
That route adds API credentials, response handling, caching, privacy decisions and failure cases. It also needs maintenance when the external service changes. Use it only when you need a very specific integration and are comfortable maintaining custom code.
Install a geolocation add-on
For a no-code or low-code setup, install a Gravity Forms geolocation add-on that adds location fields and stores location data with the entry. The Gravity Forms Geolocation Add-On, for example, supports location data such as address details, latitude and longitude, and can display a map in the entry view.
After activating the add-on, open its settings and configure the required location provider or API credentials. The exact fields and settings depend on the add-on you install.
Enable capture on the form
Open the form’s geolocation settings and enable location capture for that form. If the add-on supports address autocomplete, open the Address field’s advanced settings and enable its geolocation suggestions. Some add-ons capture location for every submission by default, while others require a form-level switch.
Save the form, submit it from the front end, and open the entry. Confirm that the expected address, coordinates or map data were saved. Existing entries normally will not gain location data retroactively.
Test accuracy and privacy
Test from a normal connection, a mobile connection and, if relevant, behind your site’s proxy or CDN. Confirm that the saved value is approximate when it comes from an IP address, and that browser-based location features handle denied permissions without blocking submission.
Tell visitors what location data you collect, why you collect it, how long you retain it and who receives it. Avoid sending precise coordinates in email notifications unless the recipients genuinely need them.
Let Gravity Forms Geolocation Add-On do it
Adds IP-based location fields directly to Gravity Forms, for location-aware entries without custom coding.
Sources
- gravitykit.dev /merge-tags/ip/?utm_source=openai
- gravityforms.com /add-ons/Geolocation/?utm_source=openai
- gravityforms.com /blog/get-started-geolocation-add-on-tutorial/?utm_source=op…
- community.gravityforms.com /t/pre-populate-hidden-field-with-ip-passed-over-to-api/1500…
Questions
- Can Gravity Forms capture location without a plugin?
- Gravity Forms can capture the submitter’s IP address without a plugin, but it does not natively convert that address into country, city or coordinate fields. You can store <code>{ip}</code> in a Hidden field, then process the address with custom code or an external geolocation service. For most sites, an add-on is simpler to maintain.
- Does the {ip} merge tag give a visitor’s exact location?
- No, the <code>{ip}</code> merge tag gives the IP address associated with the submission, not an exact physical position. IP databases can estimate a region, but VPNs, mobile carriers, proxies and shared networks can make the result wrong. Treat IP-based location as approximate and avoid presenting it as GPS data.
- Can I capture latitude and longitude in Gravity Forms?
- Yes, but you normally need a geolocation add-on or a custom browser-and-server integration. A browser can request the visitor’s coordinates, but the visitor can deny permission and the page must handle that outcome. A geolocation add-on can store latitude and longitude with the entry and may also show the location on a map.
- Why is the captured IP address wrong behind Cloudflare or a proxy?
- The value may be the proxy or server address rather than the visitor’s original address. Gravity Forms captures the address passed by the server, so your hosting or proxy configuration must pass the client IP correctly. Ask your host to confirm the setup before relying on IP-based location for routing, fraud checks or regional restrictions.
- What is the fast way to capture geolocation?
- Install a Gravity Forms geolocation add-on, configure its location provider, enable capture for the form and submit a test entry. This avoids building custom IP lookup or browser-permission code. The Gravity Forms Geolocation Add-On can save location details with entries and display address, latitude, longitude and map information when configured correctly.