Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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

Expand Down
8 changes: 7 additions & 1 deletion Google/Authorization.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
use Piwik\Container\StaticContainer;
use Piwik\Option;
use Piwik\Piwik;
use Piwik\SettingsPiwik;
use Piwik\Url;

class Authorization
Expand Down Expand Up @@ -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;
}
}
Expand Down
2 changes: 1 addition & 1 deletion plugin.json
Original file line number Diff line number Diff line change
@@ -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"
Expand Down