diff --git a/CHANGELOG.md b/CHANGELOG.md index 94c09407..74d7d0ca 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ ## Changelog +# 5.1.3 - 2025-05-28 +- Added fallback URI for valid redirect URI check to solve issues with some Matomo for WordPress install + # 5.1.2 - 2025-03-17 - Started importing region data as the region dimension is now available in the API request diff --git a/Google/Authorization.php b/Google/Authorization.php index 01c6f4b5..74ec8c61 100644 --- a/Google/Authorization.php +++ b/Google/Authorization.php @@ -15,6 +15,7 @@ use Piwik\Container\StaticContainer; use Piwik\Option; use Piwik\Piwik; +use Piwik\SettingsPiwik; use Piwik\Url; class Authorization @@ -136,8 +137,13 @@ protected function getUserInfoByAccessToken(\Matomo\Dependencies\GoogleAnalytics private function getValidUri($uris) { $validUri = Url::getCurrentUrlWithoutQueryString() . '?module=GoogleAnalyticsImporter&action=processAuthCode'; + $settingURL = SettingsPiwik::getPiwikUrl(); + if (stripos($settingURL, 'index.php') === false) { + $settingURL .= 'index.php'; + } + $validUriFallback = $settingURL . '?module=GoogleAnalyticsImporter&action=processAuthCode'; // Some MWP installs was not working as expected when using Url::getCurrentUrlWithoutQueryString() foreach ($uris as $uri) { - if (stripos($uri, $validUri) !== \FALSE) { + if (stripos($uri, $validUri) !== \false || stripos($uri, $validUriFallback) !== \false) { return $uri; } } diff --git a/plugin.json b/plugin.json index 9e0190a2..4fc5e109 100644 --- a/plugin.json +++ b/plugin.json @@ -1,7 +1,7 @@ { "name": "GoogleAnalyticsImporter", "description": "Import reports from a Google Analytics account into Matomo.", - "version": "5.1.2", + "version": "5.1.3", "theme": false, "require": { "matomo": ">=5.0.0-rc5,<6.0.0-b1"