Getting a visitor’s country information
The Odoo CMS has built-in support for GeoIP. In a live environment, you can track a visitor’s country based on the IP address. In this recipe, we will get the country of the visitor based on the visitor’s IP address.
Getting ready
For this recipe, we will be using the my_hostel
module from the previous recipe. In this recipe, we will hide some hostels on the web page based on the visitor’s country. You will need to download the GeoIP database for this recipe. After that, you will need to pass the database location from the cli
option, like this:
./odoo-bin -c config_file --geoip-db=location_of_geoip_DB
Or, follow the steps from this document sheet:
If you don’t want to locate the GeoIP database in /usr/share/GeoIP/
, use the --geoip-city-db
and --geoip-country-db
options of...