aholkner / matomo-cloudflare-location-provider

Provide Geolocation information to Matomo (Piwik) from Cloudflare request header
4 stars 1 forks source link

Make plugin compatible with Matomo 4 #3

Open Findus23 opened 4 years ago

Findus23 commented 4 years ago

Hi, hope you are doing well!

Matomo 4 is progressing steadily and it would be great if this plugin was also available for it.

Migrating the plugin should be pretty simple as there were not many breaking changes.

You can find the migration guide here: https://developer.matomo.org/guides/migrate-matomo-3-to-4

It boils down to:

If you later fix a bug and also want to backport it to the 3.x plugin, you can cherry-pick the commit to the old branch, release a new version (lower than the one for 4.x) and publish it and 3.x users should get this update.

If you have questions about anything, just ask me!

allanedk commented 3 years ago

@Findus23 did you try upgrading to Matomo 4? Will this plugin will be disabled when upgraded (until a v4 version is released)?

Eismann82 commented 3 years ago

@allanedk we have upgraded to Matomo 4 and are now using Matomo 4.0.5 unfortunately the plugin has been disabled Under Plugins it says "CloudflareLocationProvider needs Piwik <4.0.0-b1".

msheakoski commented 3 years ago

The same functionality can also be achieved without this plugin. In Matomo's Administration:

  1. General Settings / Configuration for server variables used by GeoIP 2 server modules: change MM_COUNTRY_CODE to HTTP_CF_IPCOUNTRY
  2. Geolocation / Location Provider: select DBIP / GeoIP 2 (HTTP Server Module)

You can also keep the default MM_COUNTRY_CODE and set it via NGINX. This lets you use fallbacks such as a local database if CloudFlare's header is not available:

fastcgi_param MM_COUNTRY_CODE $http_cf_ipcountry;
ctholho commented 3 years ago

If you can't freely control your server, you can still follow @msheakoski instructions but set MM_COUNTRY_CODE to HTTP_CF_IPCOUNTRY as described by the cloudflare manual for configuring IP Geolocation for PHP applications.

After I did that I could activate the DBIP / GeoIP Server Module which was greyed out before.

msheakoski commented 3 years ago

you can still follow @msheakoski instructions but set MM_COUNTRY_CODE to HTTP_CF_IPCOUNTRY

@ctholho Thank you for pointing out this typo! I have updated my comment to use the correct variable name.