Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
eb695a4
Adapt Vue sources to the Vite build and rebuild dist for Matomo 6
sgiehl Jun 19, 2026
8ea2860
Rebuild Vue dist files for Vue 3.5
sgiehl Jun 19, 2026
a9bea1c
DEV-20451: sync system-test fixtures for accurate time-spent metric
caddoo Jul 9, 2026
5882524
DEV-20451: refresh fixtures after removing nb_hits_with_time_spent
caddoo Jul 16, 2026
d08286e
Merge commit '8ea2860' into DEV-20451
caddoo Jul 16, 2026
b7f059a
Merge remote-tracking branch 'origin/prepare6x' into DEV-20451
caddoo Jul 17, 2026
467e4e1
Merge remote-tracking branch 'origin/prepare6x' into DEV-20451
caddoo Jul 21, 2026
9aaf1f1
Update expected UI screenshots for the new headless Chrome (Node 24 /…
sgiehl Jun 22, 2026
77c5b90
DEV-20451: sync AutoSuggestAPITest fixture for accurate per-pageview …
caddoo Jul 22, 2026
edbc59c
Drop the array custom-variable name from the tracking fixture
sgiehl Jul 24, 2026
21f3011
Recover the malformed-custom-variable coverage via direct cvar injection
sgiehl Jul 27, 2026
8dfb104
Merge commit '9aaf1f17d32308e0f02e41aa365167314b52a75e' into DEV-20451
tzi Jul 27, 2026
2d8edfe
Merge commit '839c3c7e02a52cf7a2665b58ed75c0ccc5b18d8c' into DEV-20451
tzi Jul 27, 2026
25e0375
Merge 6.x-dev submodule pin into DEV-20451
caddoo Aug 4, 2026
4baf80d
Prepare for Matomo 6 (#141)
sgiehl Aug 10, 2026
6ae495b
Add percent-of-total metric columns to system test expected files (#139)
caddoo Aug 11, 2026
316f923
Translated using Weblate (Chinese (Traditional Han script))
Aug 24, 2026
0969f06
Merge pull request #143 from weblate/weblate-matomo-plugin-customvari…
AltamashShaikh Aug 25, 2026
8216b03
Translated using Weblate (German) (#144)
weblate Aug 27, 2026
8301808
Translated using Weblate (Chinese (Traditional Han script)) (#145)
weblate Sep 2, 2026
a006135
Move the checks onto the shared umbrella and build the other dev bran…
snake14 Sep 11, 2026
0ec41f5
Run PHPStan at level 5 [ignore_release] (#148)
snake14 Sep 14, 2026
a2d767a
Ship the shared pre-push hook [ignore_release] (#149)
snake14 Sep 17, 2026
f82da2d
Update the expected file for the percentage columns of DEV-15528
tzi Aug 17, 2026
bd8141c
Keep the percent of total column label as it is on 6.x-dev
caddoo Aug 17, 2026
f2a57f8
Update the expected label for the shortened percent of total column
tzi Sep 8, 2026
acab448
Merge 6.x-dev submodule pin into DEV-20451
caddoo Sep 20, 2026
722a2ae
Add the codex review wrapper [ignore_release] (#147)
snake14 Sep 22, 2026
7f8d512
Merge commit 'f2a57f8e92' into DEV-20451
sgiehl Sep 23, 2026
04d7ef2
Show the time measured on a site search in the visits log
sgiehl Sep 27, 2026
6d752a4
Fix failing tests on 6.x-dev [no_release] (#150)
lachiebol Sep 27, 2026
d1a197f
Merge commit '6d752a48a6' into DEV-20451
sgiehl Sep 28, 2026
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
346 changes: 346 additions & 0 deletions .git-hooks-matomo/pre-push

Large diffs are not rendered by default.

21 changes: 21 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Plugins CI

on:
pull_request:
types: [opened, synchronize, reopened, edited]
push:
branches:
- '**.x-dev'
workflow_dispatch:

permissions:
actions: read
contents: read
pull-requests: read

jobs:
ci:
uses: matomo-org/plugin-ci-workflows/.github/workflows/plugin-ci.yml@main
with:
plugin-name: CustomVariables
verify-hook: true
27 changes: 27 additions & 0 deletions .github/workflows/codex-review.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Codex Review

on:
# nosec — label-gated; this wrapper runs no PR code, see matomo-org/plugin-ci-workflows README.md
pull_request_target:
types: [labeled]

permissions:
contents: none

jobs:
codex-review:
# The shared workflow gates every one of its own jobs on this label, but it also carries a
# cancel-in-progress concurrency group. Without this condition an unrelated label would still
# instantiate it, claim that group, and cancel a review already running on this pull request.
if: ${{ github.event.label.name == 'codex-review' }}
uses: matomo-org/plugin-ci-workflows/.github/workflows/plugin-codex-review.yml@main
permissions:
actions: read
contents: read
issues: write
pull-requests: write
with:
plugin-name: CustomVariables
secrets:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
TESTS_ACCESS_TOKEN: ${{ secrets.TESTS_ACCESS_TOKEN }}
32 changes: 0 additions & 32 deletions .github/workflows/matomo-ai-checklist.yml

This file was deleted.

8 changes: 4 additions & 4 deletions .github/workflows/matomo-tests.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Action for running tests
# This file has been automatically created.
# To recreate it you can run this command
# ./console generate:test-action --plugin="CustomVariables" --php-versions="8.1,8.5" --schedule-cron="0 3 * * 6"
# ./console generate:test-action --plugin="CustomVariables" --php-versions="matomo6_min_php,matomo6_max_php" --schedule-cron="0 3 * * 6"

name: Plugin CustomVariables Tests

Expand Down Expand Up @@ -37,7 +37,7 @@ jobs:
strategy:
fail-fast: false
matrix:
php: [ '8.1', '8.5' ]
php: [ 'matomo6_min_php', 'matomo6_max_php' ]
target: ['minimum_required_matomo', 'maximum_supported_matomo']
database:
- { engine: 'Mysql', version: '8.0' }
Expand All @@ -59,7 +59,7 @@ jobs:
mysql-version: ${{ matrix.database.version }}
matomo-test-branch: ${{ matrix.target }}
artifacts-pass: ${{ secrets.ARTIFACTS_PASS }}
upload-artifacts: ${{ matrix.php == '8.1' && matrix.target == 'maximum_supported_matomo' && matrix.database.engine == 'Mysql' }}
upload-artifacts: ${{ matrix.php == 'matomo6_min_php' && matrix.target == 'maximum_supported_matomo' && matrix.database.engine == 'Mysql' }}
UI:
runs-on: ubuntu-24.04
steps:
Expand All @@ -73,7 +73,7 @@ jobs:
plugin-name: 'CustomVariables'
matomo-test-branch: 'maximum_supported_matomo'
test-type: 'UI'
php-version: '8.1'
php-version: 'matomo6_min_php'
node-version: '24'
mysql-engine: 'Mysql'
mysql-version: '8.0'
Expand Down
43 changes: 0 additions & 43 deletions .github/workflows/phpcs.yml

This file was deleted.

25 changes: 25 additions & 0 deletions .github/workflows/weekly-branch-sweep.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Dispatches this plugin's build for each maintained branch that is not the default one, because
# GitHub only ever runs `schedule` from the default branch's copy of a workflow file. The logic
# lives in matomo-org/plugin-ci-workflows; see the "Branch sweep" section of its README.md for
# why this dispatches rather than building another branch's source here.

name: Weekly branch sweep

on:
schedule:
# Sunday, so it does not compete with this plugin's own Saturday build. Keeps the minute and
# hour of matomo-tests.yml's cron, so the fleet stays staggered across the window.
- cron: '0 3 * * 0'
workflow_dispatch:

permissions: {}

jobs:
sweep:
# Granted by the caller because permissions can only be maintained or reduced down a call
# chain, never elevated: the called workflow declares these too, but that can only cap them,
# not supply them, so without this block the dispatch is unauthorised.
permissions:
actions: write
contents: read
uses: matomo-org/plugin-ci-workflows/.github/workflows/plugin-branch-sweep.yml@main
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@ tests/System/processed/*text
/vue/dist/*.common.js
/vue/dist/*.map
/vue/dist/*.development.*
# only the minified bundle is served; the unminified one is no longer built
/vue/dist/*.umd.js
11 changes: 5 additions & 6 deletions API.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
use Piwik\Archive;
use Piwik\Container\StaticContainer;
use Piwik\DataTable;
use Piwik\Date;
use Piwik\Metrics;
use Piwik\Piwik;

Expand All @@ -28,21 +27,21 @@ class API extends \Piwik\Plugin\API
/**
* @param int $idSite
* @param string $period
* @param Date $date
* @param string $date
* @param string $segment
* @param bool $expanded
* @param int $idSubtable
* @param int|null $idSubtable
*
* @return DataTable|DataTable\Map
*/
protected function getDataTable($idSite, $period, $date, $segment, $expanded, $flat, $idSubtable)
{
$dataTable = Archive::createDataTableFromArchive(Archiver::CUSTOM_VARIABLE_RECORD_NAME, $idSite, $period, $date, $segment, $expanded, $flat, $idSubtable);
$dataTable->queueFilter('ColumnDelete', 'nb_uniq_visitors');
$dataTable->queueFilter('ColumnDelete', ['nb_uniq_visitors']);

if ($flat) {
$dataTable->filterSubtables('Sort', array(Metrics::INDEX_NB_ACTIONS, 'desc', $naturalSort = false, $expanded));
$dataTable->queueFilterSubtables('ColumnDelete', 'nb_uniq_visitors');
$dataTable->queueFilterSubtables('ColumnDelete', ['nb_uniq_visitors']);
}

return $dataTable;
Expand Down Expand Up @@ -166,9 +165,9 @@ public function getUsagesOfSlots($idSite)
'page' => array_fill(1, $numVars, array()),
);

/** @var DataTable $customVarUsages */
$today = StaticContainer::get('CustomVariables.today');
$date = '2008-12-12,' . $today;
/** @var DataTable $customVarUsages */
$customVarUsages = Request::processRequest(
'CustomVariables.getCustomVariables',
array('idSite' => $idSite, 'period' => 'range', 'date' => $date,
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# CHANGELOG

6.0.0 - 2026-08-09
- Compatibility with Matomo 6

5.0.6 - 2026-04-27
- Updated API documentation

Expand Down
2 changes: 1 addition & 1 deletion RecordBuilders/CustomVariables.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ protected function aggregate(ArchiveProcessor $archiveProcessor): array
}


protected function aggregateCustomVariable(DataTable $record, array &$metadata, array &$metadataFlat, LogAggregator $logAggregator, string $slot): void
protected function aggregateCustomVariable(DataTable $record, array &$metadata, array &$metadataFlat, LogAggregator $logAggregator, int $slot): void
{
$keyField = "custom_var_k" . $slot;
$valueField = "custom_var_v" . $slot;
Expand Down
4 changes: 1 addition & 3 deletions Reports/GetCustomVariables.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,7 @@ public function getFooterMessageExplanationMissingMetrics()
// no footer message for subtables
$out = '';
Piwik::postEvent('Template.afterCustomVariablesReport', array(&$out));
if (!empty($message)) {
$message .= $out;
}
$message .= $out;
}

return $message;
Expand Down
6 changes: 5 additions & 1 deletion Tracker/CustomVariablesRequestProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ public function processRequestParams(VisitProperties $visitProperties, Request $
}

$request->setMetadata('CustomVariables', 'visitCustomVariables', $visitorCustomVariables);

return false;
}

public function onNewVisit(VisitProperties $visitProperties, Request $request)
Expand All @@ -71,7 +73,7 @@ public function afterRequestProcessed(VisitProperties $visitProperties, Request
$action = $request->getMetadata('Actions', 'action');

if (empty($action) || !($action instanceof Action)) {
return;
return false;
}

$customVariables = self::getCustomVariablesInPageScope($request);
Expand All @@ -84,6 +86,8 @@ public function afterRequestProcessed(VisitProperties $visitProperties, Request
$action->setCustomField($field, $value);
}
}

return false;
}

public static function getCustomVariablesInVisitScope(Request $request)
Expand Down
12 changes: 6 additions & 6 deletions lang/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,23 @@
"ColumnCustomVariableName": "Name der benutzerdefinierten Variable",
"ColumnCustomVariableValue": "Wert der benutzerdefinierten Variable",
"CreateNewSlot": "Die Anzahl verfügbarer benutzerdefinierter Variablen erhöhen",
"CreatingCustomVariableTakesTime": "Neue benutzerdefinierte Variablen zu erstellen kann viel Zeit beanspruchen, abhängig von der Größe Ihrer Datenbank. Deshalb ist dieser Vorgang nur über Kommandozeilen verfügbar.",
"CreatingCustomVariableTakesTime": "Neue benutzerdefinierte Variablen zu erstellen, kann viel Zeit beanspruchen, abhängig von der Größe Ihrer Datenbank. Deshalb ist dieser Vorgang nur über Kommandozeilen verfügbar.",
"CurrentAvailableCustomVariables": "Aktuell können Sie bis zu %s benutzerdefinierte Variablen pro Seite einsetzen.",
"CustomVariables": "Benutzerdefinierte Variablen",
"CustomVariablesReportDocumentation": "Dieser Bericht enthält Informationen über Ihre benutzerdefinierten Variablen. Klicken Sie auf einen Variablennamen, um die Verteilung der Werte zu sehen. %1$s Für mehr Informationen über benutzerdefinierte Variablen, lesen Sie die %2$sDokumentation auf matomo.org%3$s",
"CustomVariablesSubcategoryHelp1": "Dieser Bericht enthält Informationen über benutzerdefinierte Variablen. Klicken Sie auf eine Variable um die Aufteilung der Werte zu sehen.",
"CustomVariablesReportDocumentation": "Dieser Bericht enthält Informationen über Ihre benutzerdefinierten Variablen. Klicken Sie auf einen Variablennamen, um die Verteilung der Werte zu sehen. %1$s Für mehr Informationen über benutzerdefinierte Variablen lesen Sie die %2$sDokumentation auf matomo.org%3$s",
"CustomVariablesSubcategoryHelp1": "Dieser Bericht enthält Informationen über benutzerdefinierte Variablen. Klicken Sie auf eine Variable, um die Aufteilung der Werte zu sehen.",
"CustomVariablesSubcategoryHelp2": "Lesen Sie mehr zu diesem Thema in der Online-Anleitung.",
"Index": "Index",
"ManageDescription": "Diese Übersicht zeigt alle benutzerdefinierten Variablen und deren Gebrauch für Webseite %s. Die Namen auf jeder Position sind danach sortiert, wie oft sie insgesamt benützt wurden.",
"MetricsAreOnlyAvailableForVisitScope": "Hinweis: Die Metriken %1$s sind nur für benutzerdefinierte Variablen mit Geltungsbereich %2$s verfügbar.",
"MetricsNotAvailableForPageScope": "Für benutzerdefinierte Variablen mit Geltungsbereich %1$s ist der Wert für diese Metriken %2$s",
"PluginDescription": "Benutzerdefinierte Variablen sind (Name, Wert)-Paare, welche Sie mit Hilfe der Javascript API Besuchern oder deren Aktionen zuweisen können. Matomo wird dann Besuche, Seiten, Konversionen für jede dieser benutzerdefinierten Namen und Werte protokollieren. Die detaillierten benutzerdefinierten Variablen lassen sich für jeden Benutzer und jede Aktion im Besucher Log anzeigen. Dieses Plugin wird benötigt für das Ecommerce Analytics Feature!",
"PluginDescription": "Benutzerdefinierte Variablen sind „(Name, Wert)“-Paare, welche Sie mit Hilfe der Javascript-API Besuchern oder deren Aktionen zuweisen können. Matomo wird dann Besuche, Seiten, Konversionen für jede dieser benutzerdefinierten Namen und Werte protokollieren. Die detaillierten benutzerdefinierten Variablen lassen sich für jeden Benutzer und jede Aktion im Besucherprotokoll anzeigen. Dieses Plugin wird benötigt für das Ecommerce-Analytik-Feature!",
"ScopeConversion": "Anwendungsbereichkonversion",
"ScopePage": "Anwendungsbereich Seite",
"ScopeVisit": "Anwendungsbereich Besuch",
"ScopeX": "Anwendungsbereich %s",
"SlotsReportIsGeneratedOverTime": "Daten für diesen Bericht werden periodisch veröffentlicht. Es mag ein oder zwei Tage dauern, bis Daten sichtbar sind und einige Wochen bis der Bericht vollständig aussagekräftig ist.",
"ToCreateCustomVarExecute": "Um eine neue benutzerdefinierte Variable zu erstellen, führen Sie in Ihrer Matomo Installation folgenden Befehl aus:",
"SlotsReportIsGeneratedOverTime": "Daten für diesen Bericht werden periodisch veröffentlicht. Es mag ein oder zwei Tage dauern, bis Daten sichtbar sind, und einige Wochen, bis der Bericht vollständig aussagekräftig ist.",
"ToCreateCustomVarExecute": "Um eine neue benutzerdefinierte Variable zu erstellen, führen Sie in Ihrer Matomo-Installation folgenden Befehl aus:",
"Unused": "Unbenutzt",
"UsageDetails": "%1$s Besuche und %2$s Aktionen seit der Erstellung dieser Webseite.",
"Usages": "Verwendungen"
Expand Down
26 changes: 13 additions & 13 deletions lang/zh-tw.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,25 @@
"ColumnCustomVariableName": "自訂變數名稱",
"ColumnCustomVariableValue": "自訂變數值",
"CreateNewSlot": "增加自訂變數可用的欄位",
"CreatingCustomVariableTakesTime": "取決於您的資料庫大小,新增自定變數 slot 可能需要很長時間。因此,這只能通過在命令行上執行命令來完成。",
"CreatingCustomVariableTakesTime": "依你的資料庫大小而定,新增自訂變數欄位可能需要很長的時間。因此,這項作業只能透過在指令列執行的指令來完成。",
"CurrentAvailableCustomVariables": "目前每個網站最多可以建立 %s 個自訂變數。",
"CustomVariables": "自訂變數",
"CustomVariablesReportDocumentation": "這份報表包含你的自訂變數資訊。點擊變數名稱來查看分配的值。%1$s更多關於自訂變數的資訊請查看 %2$smatomo.org 上的自訂變數說明文件%3$s",
"CustomVariablesSubcategoryHelp1": "此報表包括自定變數的資訊。點擊變數名稱查閲數值分佈。",
"CustomVariablesSubcategoryHelp2": "在線上說明了解更多此主題",
"CustomVariablesReportDocumentation": "這份報表包含你的自訂變數資訊。點擊變數名稱來查看值的分佈情形。%1$s更多關於自訂變數的資訊請查看 %2$smatomo.org 上的自訂變數說明文件%3$s",
"CustomVariablesSubcategoryHelp1": "此報表包含你自訂變數的相關資訊。點擊變數名稱即可查看其值的分佈情形。",
"CustomVariablesSubcategoryHelp2": "請參閱線上指南以了解更多關於此主題的資訊。",
"Index": "索引",
"ManageDescription": "這個總覽顯示「%s」的所有自訂變數和它們的用途。每個欄位中的名稱將以總使用次數來排序。",
"MetricsAreOnlyAvailableForVisitScope": "注意:%1$s只有自訂變數的範圍有數據%2$s。",
"MetricsNotAvailableForPageScope": "自訂變數範圍 %1$s 中,欄位數據的值為 %2$s。",
"PluginDescription": "自訂變數是透過 Javascript API 為訪客或他們的活動以 [名稱 → 值] 來配對。Matomo 接著會產生這些自訂名稱與值有多少訪問、頁面及轉換的報表。可以在訪客紀錄中查看每位使用者和活動的自定變數詳情。這個外掛必須要使用電子商務分析功能!",
"ScopeConversion": "範圍轉換",
"ManageDescription": "這個總覽顯示「%s」的所有自訂變數欄位及其使用情形。每個欄位中的名稱將以總使用次數來排序。",
"MetricsAreOnlyAvailableForVisitScope": "注意:%1$s 指標僅適用於範圍為 %2$s 的自訂變數。",
"MetricsNotAvailableForPageScope": "對於範圍為 %1$s 的自訂變數,這些指標的欄位值為 %2$s",
"PluginDescription": "自訂變數是(名稱, 值)配對,你可以透過 JavaScript API 將其指派給訪客或其任何活動。Matomo 接著會報告每組自訂名稱與值有多少訪問、網頁與轉換。你可以在訪客紀錄中查看每位使用者與每個活動的自訂變數詳情。使用電子商務分析功能必須安裝這個外掛!",
"ScopeConversion": "轉換範圍",
"ScopePage": "網頁範圍",
"ScopeVisit": "訪客範圍",
"ScopeVisit": "訪問範圍",
"ScopeX": "%s 範圍",
"SlotsReportIsGeneratedOverTime": "這份報表的資料將會被補充。可能會花上一到兩天來產生資料,並且花上數周才會有完整準確的報表。",
"SlotsReportIsGeneratedOverTime": "這份報表的資料會隨時間逐漸累積。可能需要一到兩天才會看到資料,數週後報表才會完全準確。",
"ToCreateCustomVarExecute": "要建立新的自訂變數欄位請在 Matomo 安裝中執行以下指令:",
"Unused": "未使用",
"UsageDetails": "自從此網站建立後已有 %1$s 次訪問數和 %2$s 個活動。",
"Usages": "用途"
"UsageDetails": "自從此網站建立後已有 %1$s 次訪問和 %2$s 個活動。",
"Usages": "使用次數"
}
}
Loading
Loading