Hi, I’m currently attempting to query the Matomo reporting HTTP API, but am struggling with creating “dimension” type filters on hostname and page path.
Can anyone please suggest any good examples of how I could do this sort of filtering in HTTP (or PHP) please?
Mind numbing details as follows.
We have a Drupal site with several hundred sub-domains. The content (and consequently the page paths) is usually same across the domains, the main differences are logos and styling.
We currently use Google’s Universal Analytics API (with PHP library) to extract data for reporting. The report defaults to 90 days and includes:
- A line graph of total ga:pageviews (Matomo pageviews? nb_hits?) views over 90 days.
- Various bar charts that show percentage traffic to top ga:pagePaths (Matomo Actions.PageUrl?)
The report default to data from all domains but can be filtered by ga:hostname (part of Matomo Actions.PageUrl?)
As you may know UA stops collecting data at the end of July 2023 and GA4 will only keep 14 months of data tops. So, I have setup a local copy of Matomo and believe I have successfully imported over 7 years data from UA which we really want to keep using.
However, I am struggling to reproduce the data extraction I do thru UA.
I can extract figures that seem similar to total page views doing this:
However, when I add filter_column and filter_pattern to the URL I get 0 results.
Basically I would like create 2 “dimension filters”.
Firstly a filter where hostname is in a list of one or more sub-domains say:
Secondly, filter where page path was in a REGEX like this:
If you read all this… I’m impressed