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:

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.

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.

Add new form in WPForms

This will open up the template Library.

wpforms template library

Click on Use Template to choose the simple form template (or any other template that works for you).

use template

Your new simple form will now open up in the form builder.

WPForms Simple Contact Form Template

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.

Save button to save your form

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.

WPForms addons

Once in, find the one labeled Geolocation Addon then click Install Addon » Activate to get started.

geolocation addon

The Geolocation addon will now be ready to start collecting site visitor location data since it’s a simple plug-and-play addon.

WPForms geolocation 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 

wpforms settings

On the settings page, click on the Geolocation tab.

geolocation addon

Once in, choose your preferred mapping API service.

wpforms geolocation addon

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.

current location geolocation settings

Next, enter the API key/access token for the service you selected, then save settings.

current location geolocation 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,

Opening the WPForms Entries page

Look for the form whose entries you’d like to view.

View form entries

Now, you can click on View to access a form entry’s submission data.

view form entry

Once you do this, you’ll see an interactive Map, as well as the following information:

  • City, State
  • Zip code
  • Country
  • Approximate latitude and longitude

interactive map wordpress location

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.

Address form field

In the Advanced tab, toggle the Enable Address Autocomplete button.

Enabling address autocomplete

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.

display map

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!

address field frontend

And there you have it!

You now know how to track WordPress user locations in WordPress with form submissions.


Please enter your comment!
Please enter your name here