How to Install and Use the Geolocation Addon with WPForms

Would you like to learn more about the locations of your visitors? With the Geolocation addon from WPForms, you can easily collect geographical data on each of your leads.

In this article, we will show you how to install and use the Geolocation addon for WPForms.

Requirements: You will need a Pro license level or higher to access the Geolocation addon.

Setting Up the Geolocation Addon

Before getting started, you’ll first need to make sure that WPForms is installed and activated on your WordPress site.

Once you’ve got WPForms installed and your license is verified, you’ll be able to quickly install and activate the Geolocation addon.

After you’ve activated the addon, you can configure the addon’s settings under WPForms » Settings and selecting the Geolocation tab.

From here, you’ll have the option to choose which provider you’d like to provide your geolocation information from the Places Provider section.

You can also optionally allow your user’s location to be pre-filled into a form by checking the Current Location checkbox.

Google Places

Note: Google Places requires your site to have an SSL certificate (e.g., load over HTTPS). If you’d like more information on how to get an SSL certificate for your site, be sure to check out WPBeginner’s guide on how to get a free SSL certificate for more details.

To set up Google Places within your forms, you’ll need to generate an API Key from within your Google Developer Console. To do this, select the project you’d like to enable this key on from the Select a Project menu. If you haven’t previously created a project, click the New Project to create a new one.

Note: Google will require you to enable billing on your account in order to use the Places feature. For more details on cost, be sure to check out Google’s pricing page.

Once you’ve opened up your project, you’ll need to enable the following APIs:

  • Google Places API
  • Google Maps JavaScript API
  • Geocoding API

Once you’ve enabled the APIs on your site, navigate to the Credentials tab in your Google Console. From here, click the Create Credentials button and select the API key option to generate an API key.

After your key has been created, click the pencil icon to open up the key’s settings. From here, you’ll need to configure the following options:

Application Restrictions

To allow your API key to be used within WPForms, you’ll need to select the HTTP Referrers option. This will allow your key to be used within websites.

Website Restrictions

Once you’ve allowed your key to be used on websites, it’s recommended that you restrict which domains your key can be used on. To do this, add the domain(s) you’d like to use your key on. If you’d like to allow the key to be used across an entire domain, you can use the * (asterisk) key.

API Restrictions

Once you’ve restricted your key by Application and Website, you’ll need to restrict your key by API. To do this, click the Restrict key option.

This will reveal another dropdown, where you’ll need to select the specific APIs you’d like to restrict your key to. From this dropdown, you’ll need to select the following APIs:

  • Google Places API
  • Google Maps JavaScript API
  • Geocoding API

Once you’ve selected these APIs, go ahead and click the Save button to save your settings.

After saving your settings, you’ll be redirected to an overview of all available API keys. Go ahead and copy the value under the Key heading and head back over to your WPForms settings.

Within your WPForms settings, paste the API Key you just copied into the API Key field and save your settings.

Algolia Places

To generate an API Key specific to Algolia Places, you’ll first need to create a new app within your Algolia account.

Once you’ve created your new app, open up your API Key settings by clicking the API Keys option in the left menu.

From here, copy your app’s Application ID. If set up correctly, this value should start with the pl- prefix.

Back in your WPForms settings, go ahead and paste this value into the Application ID field.

Then, head back over to your Algolia settings and copy your app’s Search-Only API Key.

Then, go ahead and paste this value into the Search Only API Key field within your WPForms settings and click the Save Settings button.

Adding Address Autocomplete to Your Forms

Now that you’ve configured your Geolocation settings, you’re ready to enable the Geolocation addon’s autocomplete feature within your forms.

To add autocomplete, you’ll first need to create a new form or edit an existing form.

Within your form builder, go ahead and add an Address field, if you haven’t already.

Then, within the Field Options, click on Advanced Options to open up additional settings. From here, you can turn on the address autocomplete feature by checking the Enable Address Autocomplete box.

If you’d like, you can also choose to display an interactive map on the front end of your forms by checking the Display Map option.

Once you’ve got everything set up, be sure to save your form.

Viewing Entry Location Data

To view an entry’s geolocation data, go to WPForms » Entries and choose the form you’d like to see Geolocation details for, then click View to open an individual entry page.

View individual entry page in WPForms

In addition to an interactive Google Map, you’ll see details such as city, state, country, and zip code, as well as an approximate latitude/longitude for the user’s town.

Geolocation Data in Entry

Including Geolocation in Form Notification Emails

If you’d like, you can also include geolocation data in automatic notification emails for your forms.

Note: For extremely large websites or those with a large volume of form submissions, it is not recommended to include geolocation data in notification emails as it could impact server speed.

To set this up, open the form builder and go to Settings » Notifications. Then scroll to the Message and add the {entry_geolocation} Smart Tag.

Note: For more details, check out this guide on how to use Smart Tags in WPForms.

Add geolocation smart tag to notification email setting

When the notification email is sent out, it will now include location data for the user.

WPForms Geolocation in notification email

Note: Geolocation data is stored in entries and can be displayed in notification emails, however the {entry_geolocation} Smart Tag is not currently able to be sent to third party integrations such as Zapier connections.

That’s it! You can now collect geolocation data to learn more about your users.

Next, would you also like to send out different notification emails depending on the user’s form selections? To learn how, be sure to check out our tutorial on conditional form notifications.