matomo-org/looker-studio-connector

support re-aggregation of all Matomo metrics

Opened this issue · 3 comments

Looker Studio supports creating reports with arbitrary dimensions and metrics. If a flattened report has multiple dimensions and only one is selected, Looker Studio will try to aggregate the columns so only a single instance of each dimension value remains in the chart.

But this only works when the right metadata is present in the connector schema (specifically, how metrics are aggregated). Currently, we set every metric to be non-re-aggregatable.

To make normal metrics in Matomo re-aggregatable:

  • introduce aggregation metadata in Matomo core and fill it out for all available reports
  • in the connector, set the aggregation based on this metadata

To make processed metrics in Matomo re-aggregatable:

  • introduce a metadata to reveal the processed metric's formula (eg, bounce_count / nb_visits)
  • introduce mechanism to include all temporary metrics used in the computation
  • in the connector
    • set metric formulas based on Matomo metadata & set aggregation to AUTO
    • fetch all temporary metrics
    • if possible, hide temporary metrics from being used by the end user

Something to keep in mind: many processed metrics in Matomo do not use columns in the report, but other data, such as metrics in past data. These would have to be made available for Looker Studio.

Workaround

There is currently a workaround that can be used in some cases. Users that want to re-aggregate can create their own calculated field that manually specifies the aggregation, and add that with the single dimension they want.

Let's create the related core issue. Once that is implemented in core, it would be great to immediately implement it in Looker Studio. Let's discuss internally the timeline.

This is actually more complicated than I initially thought. Some metrics can be added together, but it depends on the report dimension. For example, nb_visits for different rows eg can be added together in reports that have a Visit level dimension, but not an Action level dimension (since rows for different actions can share some of the same visits).

For the first version of this feature, we should be able to allow reaggregation of some metrics in the right contexts, but not all.

I've gotten this to work with normal metrics (not deployed), but there appears to be a bug in Looker Studio that prevents reaggregation of calculated fields from working. I've reported this to Looker Studio, once that issue is resolved work on this can continue.