Activating Matomo GeoIP

From PKC
Revision as of 17:11, 30 January 2023 by Emhavis2 (talk | contribs) (→‎Adjust your config.ini.php)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

The PKC-Agent fresh installation result does not come with activated Matomo GeoIP Feature. This is due to the dynamicity of the GeoIP database provided by third party data provider. At the time of this page is written, GeoIP file use is provided by db-ip.com as a part of their free services.

Introduction

GeoIP database enable us to see the approximation of user's location by using the public IP Address use to access PKC's Mediawiki. To enable this feature there are several step of configuration need to take, please continue read this page and follow below step.

Steps

Download GeoIP Database

Please download and extract following file to your local machine or directly in your pkc server.

wget https://download.db-ip.com/free/dbip-city-lite-2022-11.mmdb.gz
gunzip dbip-city-lite-2022-11.mmdb.gz

Then, rename it to DBIP-City.mmdb

mv dbip-city-lite-2022-11.mmdb DBIP-City.mmdb

Adjust your config.ini.php

Please visit the folder /cs/mountpoint/matomo/config, and open config.ini.php, and add following line on [general] section of the file.

proxy_client_headers[] = "HTTP_X_FORWARDED_FOR"

Save the file and copy the GeoIP file into docker by using below command

docker cp DBIP-City.mmdb xlp_matomo:/opt/bitnami/matomo/misc

Check Result

Please login into your matomo instance, and go to Setting -> System -> GeoLocation. Enable the DBIP/GeoIP2 options and inspect the location result. Once you try to visit PKC's Mediawiki, you should be able to see the location detected. If its showing your current location, means the feature is correctly installed.