Calculated Fields Form Blog

Tips and cases of use for a successful WordPress website with calculated forms.

Blog / How to identify the user location from the form?

How to identify the user location from the form?

Getting the user's country and region.


The "Calculated Fields Form" plugin is constantly evolving to cover a larger number of projects and use cases.

One of its most recent additions is aimed at the end user of the form.

Knowing the users is essential to build a successful relationship, and a very important piece of information is their location. There are several third-party services to identify a user's location based on their IP address. The majority of them are paid services, and would require sharing some of the user's information, which could be a major inconvenience.

But is it necessary to know the user's exact location? In practice, no. Knowing their country or region is usually more than enough in most projects. That is why we have implemented the "Location" operations module.

The "Location" operations module allows you to know the user's country, region or time zone directly from the form, without calling third-party services.

The "Location" module implements three operations that you can call from the equations in calculated fields:

The COUNTRY operation determines the user's country from the time zone in their browser.

The REGION operation, similar to the COUNTRY operation, returns the user's region/continent.

And finally the TIMEZONE operation.

To know the user's country, it is sufficient to insert a calculated field in the form, which you can set as hidden by simply ticking a checkbox, and enter the code below through the "Set Equation" attribute in its configuration:

COUNTRY();

It's as simple as that.

In the same way you can call the rest of the operations in the "Location" module.

Calculated field equation