How to track user locations with WordPress form submissions

How To Track User Locations With WordPress Form Submissions

Editorial Note: We may earn a commission when you visit links on our website.

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 1,600+ 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 the 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 who 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.

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.

Using WordPress and want to get WPForms for free?

Enter the URL to your WordPress website to install.

Comments

  1. Why is there not an option to store the Geolocation as a label so you can hand it off to a CRM automatically?

    1. Hi Matt,

      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 🙂

      1. Surely you can access the entry field like entries.country, entry.zipcode, entries.city, etc… is that possible or not?

      2. Hi Adam!
        Unfortunately, we don’t have this feature in WPForms currently.
        I apologize for any confusion!

        Have a good one 🙂

      3. Hi Daisy,

        It’s 2023 now.

        Is there any update on this feature? It’s really much needed.

        Or any developer guide for the same?

        Thanks.

      4. Hey Nazim – I apologize for the frustration that we’re not able to provide the solution you need for now or an ETA if or when this feature will be available.

        Due to the large number of feature suggestions we’re receiving from our users, we need to review and prioritize the features and enhancements to be included in each development cycle. However, I made sure that your email is noted in the feature request report so that you will get an update in case this feature will be available in a release.

        In the meantime, as a workaround, you can check our User Journey addon to achieve similar functionality and for sending the form data to custom CRMs, you can try Zapier which is very useful in such automation. We have a Zapier addon available for this. Both of these addons are available with our Pro(or higher) license.

        Thanks.

  2. 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 😉

    1. 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 🙂

      1. only 4 decimal places? im looking for an exact location or very precise. please help me!

      2. 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.

    1. 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 🙂

  3. 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

    1. 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.

      Thanks! 🙂

  4. Can your plugin determine a user location and then send them to a specific web page based on their state or region?

    1. Hey David – unfortunately we don’t have a way to redirect user based on address field (state or region) right now. However, I’ve made a note on our feature request list so we can keep it on our radar! Thanks 🙂

Add a Comment Cancel reply

We're glad you have chosen to leave a comment. Please keep in mind that all comments are moderated according to our privacy policy, and all links are nofollow. Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.

This form is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.