Do you want to learn how to detect user locations with WordPress form submissions?
Knowing the location of the visitors filling out your forms can help you understand your audience better.
Besides, location data is immensely helpful if you’re selling products and wish to process deliveries faster and with more accuracy.
In this article, we’ll show you how you can learn about the locations of your leads using WPForms and the Geolocation addon.
Detect User Geolocation With Forms
When Should You Track User Location?
Learning the locations of users filling out your WordPress forms helps you see where they are. There are several ways this can come in handy.
For instance, if a user fills out your t-shirt order form, knowing their exact geolocation on a map lets you ensure accurate delivery.
Besides, tracking WordPress user location allows you to:
- Determine popular time zones and adjust your email marketing campaigns accordingly.
- Learn where the majority of your volunteers are coming from and host an event in their city.
- Use the location of site visitors to translate your forms into other languages.
Now let’s take a look at how to find out the locations of site visitors filling out your WordPress forms.
How To Track User Locations with WordPress Form Submissions
Here’s a step-by-step guide to tracking your form users’ locations using a WordPress plugin.
In This Article
Step 1: Create a New WordPress Form
The first thing you’ll need to do is install and activate the WPForms plugin. It’s the world’s best form builder and works great as a WordPress locations plugin. For more details, see this step-by-step guide on how to install a plugin in WordPress.
After you’ve installed WPForms on your site, it’s time to build a form with geolocation capabilities. This is easy to do using the drag and drop form builder. You can also get started by choosing from the 400+ form templates that are available on paid WPForms plans.
To do this, click on WPForms from the WordPress dashboard, then click Add New.
This will open up the template Library.
Click on Use Template to choose the simple form template (or any other template that works for you).
Your new simple form will now open up in the form builder.
You can add additional fields to your WordPress form by dragging them from the left-hand panel to your form on the right-hand panel.
Then click on the field to make any changes. You can also click on a form field and drag it around to rearrange the order of form fields on your form.
When your form looks the way you want it to, click Save.
For detailed help with this step, you can check out our tutorial on how to create a simple contact form in WordPress.
Just remember, no matter what type of WordPress form you create, you can track the location of your leads.
Keep reading to learn how!
Step 2: Set Up Geolocation Tracking for WordPress
Once your WordPress form is ready, you’ll need to install and activate the WPForms Geolocation addon.
This addon lets you collect and store your site visitors’ geolocation data when they submit forms on your website. It collects the country, state, and city and stores this data with their form submissions.
To get started, go to WPForms » Addons.
Once in, find the one labeled Geolocation Addon then click Install Addon » Activate to get started.
The Geolocation addon will now be ready to start collecting site visitor location data since it’s a simple plug-and-play addon.
But if you want more advanced geolocation capabilities such as enabling automatic pre-fill by location detection, and an interactive map for location pin placement, we recommend using the Google Places API or the Mapbox API. The Geolocation addon supports both of these services.
To do this, head into the WPForms settings to find the Geolocation settings. From the WordPress dashboard, click on WPForms » Settings
On the settings page, click on the Geolocation tab.
Once in, choose your preferred mapping API service.
You’ll need to sign up with the API service you’ve selected, to get an API key or access token.
But before you add your API details, you’ll see a Current Location option on the screen. Checkmark this setting if you’d like your form to load with location data of a user automatically pre-filled.
This can speed up the form filling process for visitors.
Next, enter the API key/access token for the service you selected, then save settings.
For detailed instructions, here’s our complete documentation on setting up the Geolocation Addon.
Step 3: Get WordPress User Location Data in Form Entries
Once someone submits a form on your website, the Geolocation addon automatically collects the site visitor’s location data in WordPress.
To view this geolocation data, go to WPForms » Entries,
Look for the form whose entries you’d like to view.
Now, you can click on View to access a form entry’s submission data.
Once you do this, you’ll see an interactive Map, as well as the following information:
- City, State
- Zip code
- Approximate latitude and longitude
This information directly relates to the user that submitted the form. So you’ll get a custom map showing where they’re located.
The Geolocation addon also has address autocomplete and map pin placement features that offer increased convenience for your users.
Step 4: Enable Address Autocomplete and Map Pin Placement (Optional)
WPForms Geolocation addon offers some super useful extra features that can really improve user experience. For instance, you can show address suggestions to users while they’re entering their address and even add an interactive map that visitors can use to drop a pin to their location.
To access these features, first find the Address field under the Fancy Fields section.
In the Advanced tab, toggle the Enable Address Autocomplete button.
Now your form will have an address field with autocomplete enabled. This means that as soon as a visitor starts typing their address, they’ll see suggestions closely matching their address. It’s an excellent way to improve user experience by allowing them to fill in address information faster.
You may also want to enable the map display. For this, simply press the Display Map toggle button. This is located right under the setting for Adress Autocomplete.
With the map now included in your forms, visitors can drag the pin across the map to pinpoint their precise location. This way, you can get the exact location needed to process deliveries without any hassle.
Save your form, and your new address field will be visible on the frontend!
And there you have it!
You now know how to track WordPress user locations in WordPress with form submissions.
Next, Enable WordPress Form Tracking
Do you want to track your WordPress forms and see which ones have the best conversion rate? See our guide on tracking WordPress form submissions for tips.
You might also want to audit links to your forms to make sure your main WordPress forms have a sufficient number of links.
Detect User Geolocation With Forms
Ready to build your form? Get started today with the easiest WordPress form builder plugin. WPForms Pro includes lots of free templates and offers a 14-day money-back guarantee.
If this article helped you out, please follow us on Facebook and Twitter for more free WordPress tutorials and guides.
Why is there not an option to store the Geolocation as a label so you can hand it off to a CRM automatically?
Unfortunately we don’t have a way to do this right now and we currently don’t have any built-in way to send data to CRM. However, I’ve made a note on our feature request list so we can keep it on our radar! Thanks for the suggestion 🙂
Surely you can access the entry field like entries.country, entry.zipcode, entries.city, etc… is that possible or not?
Unfortunately, we don’t have this feature in WPForms currently.
I apologize for any confusion!
Have a good one 🙂
Not on pro yet, so haven’t been able to test this out, but: is the Lat/Long to 4 decimal places as in the above photo? We’re a fiber company and this is useful in targeting our network areas…
Would, as those above have mentioned, be useful to pass this to CRM of course 😉
Hey Terry – Yes, it shows the values up to 4 decimal places as shown in the snapshot! For sending the form data to custom CRMs, you can try Zapier which is very useful in such automation and we have a Zapier addon available with our Pro(or higher) license.
Have a good one 🙂
only 4 decimal places? im looking for an exact location or very precise. please help me!
Hi Luis! For more accurate location data, additional input would be required from your users which we aren’t able to poll for reliably at this time. If our Geolocation addon is installed, Google or Algolia API’s have been connected (as per this guide), and your user’s browser permissions are permitted to access their devices location data, then you would be able to receive fairly accurate locations recorded.
I hope this helps to clarify 🙂 If you have any further questions about this, please contact us if you have an active subscription. If you do not, don’t hesitate to drop us some questions in our support forums.
Can you add this to existing WP forms, such as registration or content submission?
Hey Vinay – Sure! Once you install and activate the Geolocation addon, it will begin collecting geographical data when users submit the form this includes existing WPForms forms, however, entries collected prior to the add-on will not have geographical data on them.
If you have any further questions, please feel welcome to contact our support team.
Have a good one 🙂
Can i use this feature to show specific fields based on the location ?
For example, if customer is located in US then can only select Red Shirt, but if based in France then can see and select only White shirt
Hey Mohammad- Currently, we do not have a way to inbuilt feature to show items/ fields based on the location of the user. I do agree it would be super helpful, though. I’ve made a note of the feature request and we’ll keep it on our radar as we plan out our roadmap for the future.
As a workaround, you can ask the user to select the respective country and show item/fields conditionally. Here is a guide to show/hide fields conditionally.