#23207·matomo

[Bug] in Metadata API, report matching based on module/action/parameters is broken

Author: diosmosisCreated Apr 7, 2025Updated Oct 1, 2026
LabelsPotential Bugtriaged

What happened?

When a Matomo plugin provides reports with multiple parameters (the parameters field in report metadata), it is possible for the API.getMetadata and API.getProcessedReport API methods to select the wrong metadata for the requested report.

This happens because the code that matches report metadata based on module (eg, MultiChannelConversionAttribution), action (eg getChannelAttribution) and parameters (eg, idGoal=1&idCampaignDimensionCombination=2) does not take into account parameter names, just their values.

This issue appears to have been present for many years, but since there are not core or premium plugins that provide reports with more than one parameter, it has never surfaced.

What should happen?

API.getMetadata and API.getProcessedReport should correctly match report metadata based on the module, action and parameters in the API request.

How can this be reproduced?

The only plugin that currently has reports with more than one parameter is MultiChannelConversionAttribution, and it's API metadata functionality is not currently working. So I've created a test plugin with small reports like this here: https://github.com/diosmosis/plugin-TestPluginReportParams/archive/refs/heads/main.zip

To reproduce:

  • Install and activate the above plugin on a local Matomo instance (you may need to change the downloaded file's name, I'm not sure).

  • Verify that the test report works by querying the API, example URL: http://localhost/index.php?module=API&method=TestPluginReportParams.getTestReport&format=xm&force_api_session=1&idTestParam1=10&idTestParam2=20&token_auth=.... This should have output like:

    <result>
    <row>
    <idTestParam1>10</idTestParam1>
    <idTestParam2>20</idTestParam2>
    </row>
    </result>
  • Verify that the test report exists in report metadata. Example URL: http://localhost/index.php?module=API&method=API.getReportMetadata&idSite=1&format=xml&force_api_session=1&token_auth=.... You should see multiple entries for <module>TestPluginReportParams</module><action>getTestReport</action>. In each entry there will be a different combination of <parameters>.

  • Finally, try to query API.getMetadata for this report with a specific combination of parameters (idTestParam1 = 1, idTestParam2 = 2). Example URL: http://localhost/index.php?module=API&method=API.getMetadata&idSite=1&apiModule=TestPluginReportParams&apiAction=getTestReport&apiParameters[idTestParam1]=1&apiParameters[idTestParam2]=2&format=xml&force_api_session=1&token_auth=....

    Notice that, even though we are looking for idTestParam1=1&idTestParam2=2, the metadata returned is for <parameters><idTestParam1>1</idTestParam1><idTestParam2>1</idTestParam2></parameters>.

Matomo version

5.3.0

PHP version

No response

Server operating system

No response

What browsers are you seeing the problem on?

No response

Computer operating system

No response

Relevant log output

bash

Validations