Conversation
Adds a {metric}_percent_of_total processed metric to every report row,
calculated from the report totals (ReportTotalsCalculator) for the
metrics reports process totals for. Values follow format_metrics like
other percent metrics and can be disabled with percent_of_total=0
(or totals=0).
The percentages match the ratio tooltips the HTML table visualization
already shows, and flow into all export formats and ImageGraph.
Scheduled reports render every processed report column, the new percent-of-total columns would add up to six columns to the emailed HTML/PDF/CSV tables.
Synced from CI run 30784690250, with these exceptions reviewed and handled locally: - Reverted unrelated sync noise (Live idVisit flake in TimezonesTest, trailing-newline-only changes in BotTracking and glossary files). - PercentOfReportTotal now also resolves totals keyed by metric id, which happens when queued filters are disabled for a request. This makes comparison rows carry their own series' percentages (computed against that series' report total) instead of missing them, so the DataComparison expected files were regenerated locally. - Renderers now translate percent-of-total column names based on the base metric translation (translateColumnNames=1 CSV exports).
caddoo
marked this pull request as draft
August 3, 2026 05:50
…total - ReportExporting UI text expectations regenerated with the percent columns the exports now contain. - ActionsDataTable_flattened screenshot: two rows with fully tied metrics swap position because array_multisort falls back to comparing row objects, which now include the percent columns. - Remaining system test expected files from CI run 30787649801 (Goals item reports and ranking-query tests gained percents through the metric-id keyed totals support).
Pivoted tables have one column per pivot dimension value, computing percent-of-total metrics there crashed PivotByDimension's column normalization (array_combine count mismatch) and would not be meaningful anyway. BackwardsCompatibility1XTest compares against OneVisitorTwoVisits expected files, the 1.x fixture cannot produce the same percentages for metrics its archives do not contain, so the percent variants of already-removed fields are removed as well.
This was referenced Aug 4, 2026
… files Unique visitor and user totals are plain sums of non-summable values, so their percent-of-total was not a meaningful denominator and its presence differed between the flat and the hierarchical Actions record a report is served from (caught by MixedArchivingAggregationTest). Also converges the ArchiveInvalidation and BlobReportLimiting expected files, whose multi-dataset test methods abort on the first failing dataset and therefore only surfaced one new file per CI round, and advances the submodule gitlinks to branches containing their updated expected files.
# Conflicts: # plugins/MarketingCampaignsReporting
caddoo
marked this pull request as ready for review
August 4, 2026 05:47
chippison
reviewed
Aug 6, 2026
- PercentOfReportTotal now refreshes its total from the table's totalsUnformatted metadata in beforeCompute(), so DataRounding's percent recompute divides the rounded row values by the rounded totals instead of the stale unrounded total (a rounded row of 10 over an unrounded total of 7 gave 142.9%). - DataRounding also processes table level totals when rows of a rounding enabled site are part of a table even though no requested site has rounding enabled (MultiSites tables requested with another ambient idSite), keeping the output independent of the site the request was made for. - Truncation summary rows get their percent-of-total columns recomputed from the summed metric values when the percent columns were computed before the generic filters ran (eg filter_sort_column=nb_visits_percent_of_total), instead of keeping the sum of the rounded per row quotients. - percent_of_total is read with Request::getBoolParameter, so 'false' disables the metrics like '0' does. - API.getProcessedReport describes the percent columns in metadata.metricTypes and metadata.metricsDocumentation. - New coverage: DataRoundingCoverageTest checks the raw quotient and formatted percentage against the rounded values, PercentOfTotalQueryParamTest covers the boolean param value and the truncation summary row. Regenerated the affected expected files.
Regenerated from CI artifacts (run 31068050774): every diff adds the percent column entries to metadata.metricTypes and metadata.metricsDocumentation. Advances the CustomVariables gitlink for its expected file.
chippison
reviewed
Aug 6, 2026
getReportMetadata() removes the metricsDocumentation block when hideMetricsDoc is set; adding the percent-of-total documentation unconditionally recreated the key with only the percent entries in it. Only add the documentation when the block is still present, like removeEmptyColumns() already does.
chippison
approved these changes
Aug 7, 2026
chippison
left a comment
Contributor
There was a problem hiding this comment.
Thanks for the quick fixes.
Looks good now
sgiehl
pushed a commit
to matomo-org/plugin-Provider
that referenced
this pull request
Aug 11, 2026
Matomo core adds always-on {metric}_percent_of_total columns to report
rows in API responses (matomo-org/matomo#24983, Matomo 6). These expected
files include the new columns and only pass against a Matomo 6 core that
contains that change.
sgiehl
pushed a commit
to matomo-org/plugin-AnonymousPiwikUsageMeasurement
that referenced
this pull request
Aug 11, 2026
Matomo core adds always-on {metric}_percent_of_total columns to report
rows in API responses (matomo-org/matomo#24983, Matomo 6). These expected
files include the new columns and only pass against a Matomo 6 core that
contains that change.
sgiehl
pushed a commit
to matomo-org/plugin-CustomVariables
that referenced
this pull request
Aug 11, 2026
Matomo core adds always-on {metric}_percent_of_total columns to report
rows in API responses (matomo-org/matomo#24983, Matomo 6). These expected
files include the new columns and only pass against a Matomo 6 core that
contains that change.
sgiehl
pushed a commit
to matomo-org/plugin-Provider
that referenced
this pull request
Aug 11, 2026
Matomo core adds always-on {metric}_percent_of_total columns to report
rows in API responses (matomo-org/matomo#24983, Matomo 6). These expected
files include the new columns and only pass against a Matomo 6 core that
contains that change.
sgiehl
pushed a commit
to matomo-org/plugin-AnonymousPiwikUsageMeasurement
that referenced
this pull request
Aug 11, 2026
Matomo core adds always-on {metric}_percent_of_total columns to report
rows in API responses (matomo-org/matomo#24983, Matomo 6). These expected
files include the new columns and only pass against a Matomo 6 core that
contains that change.
sgiehl
pushed a commit
to matomo-org/plugin-CustomVariables
that referenced
this pull request
Aug 11, 2026
* Add percent-of-total metric columns to system test expected files
Matomo core adds always-on {metric}_percent_of_total columns to report
rows in API responses (matomo-org/matomo#24983, Matomo 6). These expected
files include the new columns and only pass against a Matomo 6 core that
contains that change.
* Describe percent-of-total metrics in processed report metadata expected file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description:
Fixes DEV-14950 (#10739)
Report tables show each row's value as a % of the report total in the hover tooltip, but the Reporting API never exposed those percentages. This adds them as columns on every report row, eg
nb_visits_percent_of_totalnext tonb_visits.How it works:
PercentOfReportTotalprocessed metric is registered in the DataTablePostProcessor for every metric the report processes totals for (Metrics::getMetricIdsToProcessReportTotal()plusReport::getMetricNamesToProcessReportTotals()), using the totals the ReportTotalsCalculator already computes. Rates and averages don't get one, and neither do reports without a dimension (VisitsSummary.getetc) where a % of total is meaningless.format_metrics=0gives the raw value and the default gives eg12.3%. Subtable and flattened rows are relative to the first level report total, same as the UI tooltips.percent_of_total=0turns it off, andtotals=0also disables it since the totals are the source.totalsUnformattedmetadata, and they flow into all export formats and ImageGraph (passcolumns=nb_visits_percent_of_total) for free.percent_of_total=0so the outer request stays in control of the output.MixedArchivingAggregationTest).Note for CSV/TSV consumers: the new columns change the header and column count. Anyone parsing by position can pass
percent_of_total=0to get the previous output. This should be called out in the release notes and developer changelog.Backport: none, this is an additive feature so Matomo 6 only, 5.x takes bugfix/security only.
All system test expected files are updated (synced from CI artifacts, then every diff was verified to be a pure addition of percent columns).
Review
Cross-plugin impact (scanned local premium + public plugin clones)
percent_of_totalas a param or column name, no conflicts.Request::processRequestcalls like Referrers did, so it needs the samepercent_of_total => 0on its inner requests (follow up PR in that repo).getMetricNamesToProcessReportTotals(FormAnalytics, MCCA, PaidAdvertisingPerformance, SEKP) get percent columns for their custom metrics automatically, which is the intended behaviour.Submodule companion PRs (draft, merge after this PR)
The gitlinks in this PR point at those branches so CI can fetch them.
Checklist