Chat with usChat with us
EN

User Geolocation: How to get the current location of users?

Image

User geolocation refers to an approximate latitude and longitude describing the geographic location of a device, whether that’s a home computer, laptop, smartphone, or any connected device. Why is user geolocation in web applications helpful for providing a better browsing experience to your users? Because it can for instance automatically select the closest store from them or display personalized information relevant to their location.


Usually, to gather a device’s position, applications or websites can use the OS or browser’s built-in geolocation capabilities. But being able to get the current location of users also implies complying with regulations to protect the privacy of users. In this article, we’ll explain how it works with Woosmap Geolocation API, and its IP Geolocation approach.




What is Geolocation from Device?

According to the W3C, a « Geolocation API » defines a high-level interface to location information associated only with the device hosting the implementation.


When a user opens a location-aware app or website, a modal popup is triggered to let him share his location. If the location access is allowed, the browser or app gathers information about all available sources of location information including Global Positioning System (GPS), nearby Wi-Fi hotspots, cell towers and IP Address. This information is sent to the default geolocation service provider for augmenting their crowd-sourced database.


The main service providers for geolocation are:

  • Google Location Services for Android devices and Chrome or Firefox browsers.
  • Apple Location Services for iOS devices and Safari browser.
  • Windows Location Services for Microsoft browsers.

The service returns a location object eventually associated with a radius, or accuracy, around this location.


{
  "location": {
    "lat": 43.7828123,
    "lng": 4.091632
  },
  "accuracy": 20
}

How collecting geolocation data can comply with privacy standards?

Collecting and processing user Geolocation Data enable to gain a very accurate overview of user habits and patterns. But the built profiles may include highly sensitive categories of data. Especially if you are able to get current location data. That is why since May 26, 2018, the GDPR Regulation has significantly altered how providers of geolocation-based services can gather location from users.



How to manage privacy issues with user geolocation?

To address such changes, we’ve developed an API to leverage the location of your users. Woosmap Geolocation API is focused on IP Geolocation. This means that it can lookup the geolocation of an IP address. It can be used in a far broader range of use cases as you are able to query this API in real time when users access your website and app, or in the background process as long as you are aware of their IP addresses.


Knowing the current location of users opens up new opportunities to drive your online business.



What is the Woosmap Geolocation API?

This API provides the location of your users thanks to the public IP address of their devices. An IP address is an identifier representing a device connected to a network. We’ve built our API upon a database of lookup tables mapping IP Addresses to locations. The API accepts both IPv4 and IPV6 addresses.


A call to the API will give you a formated JSON containing the keys: country_code, country_name, continent, city, region_state, latitude, longitude, accuracy and viewport. The accuracy field represent an approximate accuracy radius, in kilometers, around the latitude and longitude associated with the IP address.


Our Store Locator Widget and Store Locator JS API embed this feature so you can seamlessly integrate with Woosmap Geolocation API in your integration. You’re able to open the widget with an initial state set for displaying the nearby stores. In the following sample, if the returned position includes the city field, we display nearby stores. Otherwise, we zoom to the country level.

The benefits of Woosmap Geolocation IP

Respect privacy with user geolocation

Our API doesn’t reveal users’ personally identifiable information. Because Woosmap’s approach to user geolocation is non-invasive. We only process the user’s anonymous IP to return an approximate location.


We don’t store any information in cookies and we don’t gather any information relative to the user device. Therefore, based on the rulings of the European data protection authority, the use of this API doesn’t require the user’s approval. With growing concerns about consumer privacy, people are becoming more selective in sharing their location data. A recent global benchmark study about mobile app user permissions has revealed that, on average, opt-in rate for use of location data declined from 9.3 percent to 7.7 percent worldwide.

Image

As more users opt to withhold their consent for sharing location, Woosmap Geolocation API can make a big difference!

Sample for your IP


Your identified IP is: 113.0.0.0


Here is a sample of a Woosmap Geolocation API call using Javascript. The fetched location is used to generate a Google static map.

Get more accuracy

The API Response provides an approximate accuracy radius, from 1 to 20 kilometres, around the latitude and longitude associated with the IP address. This radius is calculated by checking proved locations for given IP Addresses against the data within Woosmap Geolocation Database.


Our API is usually more accurate for broadband IP addresses and less accurate for cellular networks (more than 20 kilometres). Compared to the user Geolocation returned from the built-in browser geolocation capability, it is less accurate, but it has the potential to be much more broadly applied.



Woosmap Geolocation API use cases

With user geolocation based on Woosmap Geolocation API, you can provide a better browsing experience to your users. Because customers can directly benefit from content customisation that respects privacy regulations. Ip lookup geolocation also contributes to the prevention of online fraud and improves analytics to build more relevant marketing campaigns.


Content customisation

Online businesses need to provide relevant and personalised content for better visitor engagement. The first personalization that comes to mind with user geolocation is the store selection. Depending on the location accuracy and the coverage of your stores, the closest store could be wisely selected without requiring end user action, and your Store Locator initially focused on the nearby stores.


By combining the user position with your stock data, you may even like to automatically give your users the nearby Click and Collect outlets where a desired product is available.


Worldwide companies that have different stores and website could automatically redirect users to landing pages with suitable language and currency.


The checkout process can be optimised as well. The billing and shipping fields like country or postal code could be pre-populated and tax fees or delivery cost automatically calculated.


Last but not least, Marketers and Advertisers can use this API to show more accurate messages to consumers based on their location. For example, a DIY store might want to show special offers for its next sale to the people who are living in that area. This can be achieved in real time when a visitor arrives on your website, or by building users lists organised by region for an email campaign.


Regulations compliance

Every country has its own data privacy laws. The General Data Protection Regulation (GDPR) of the European Union or the California Consumer Privacy Act are perfect examples. These regulations aim to protect the consumers’ personal data. Every company must comply with the regulations of the countries where they sell their products and services.


Our Geolocation API can help. Because businesses can use it to know the visitors’ specific locations and submit them the right privacy disclosures, ensuring that they do not violate privacy laws.


But user geolocation is not just a matter of user privacy. Content and Service providers need to comply with region-based legal restrictions such as copyright, digital rights protection or censorship. A good use case could be the gambling market. There are quite a few countries that have banned online gambling. To address this, online betting websites perform geolocation at the country level to check if the visitor is allowed to access the service (sample screenshot below comes from a denied access to www.pointsbet.com due to country restriction).

Image

You may have come across sites that say, “This content has been blocked in your region”.
The field of digital media is particularly involved here. Contents like videos, music, e-books are almost always subject to country-based digital rights or censorship. With Woosmap Geolocation API, you can grant or restrict who gets access to your content according to the visitors’ countries.


Online fraud prevention

Knowledge of the location of your users can help you in confirming client identity and thus preventing online impersonation and identity theft. In a more proactive approach, you might want to block any access from a location classified as a risky zone. Woosmap Geolocation API can also help in case the order has a billing country different from the buyer country, it can be detected and flagged for manual review.


Improve analytics

User analytics is a strong tool to drive efficient marketing operations. It plays an important role in understanding the success of your marketing actions. Adding a local context to your data lets you segment and gain deeper insight into customer behaviour. You will be able to better understand regions of high and low customer engagement and drive real time change within your online marketing process. You can integrate the geolocation layer in every component of your marketing activities to trigger measures relevant to real-world metrics.



Conclusion

Geolocation is a true key to business success. Knowing the location of every incoming user or visitor strongly contributes to meeting your online business needs, including:

  • Content Personalization
  • Regulatory Compliance
  • Online Fraud Preventing
  • Augmented User Analytics
  • Targeted Advertising

If you want to implement this Geolocation solution for your particular business: Create a free Woosmap account (you will get an API Key for each of your projects).


We’re always happy to help with code or other questions you might have. So if you need further information, feel free to contact us.