Getting revenue and visits for a specific Category with referrerName segment via API

I am trying to find the most efficient way to get total revenue, visits for a particular category and segment by referrerName via API.

My problem:

I am using Piwik to track visitors and referrers to product category pages. Each product category can have many urls displaying the same products but tracked separately to distinguish between different email campaigns. For that purpose we have been using Actions.getPageUrl with great success.

Now I need to track revenue for a particular URL and also break down that revenue based on referrerName segment.

From reading documentation, I see Goals.getItemsCategory can help with that.

So I need to treat each URL as a Category and instead of Actions.getPageUrl start using Goals.getItemsCategory.

Two problems for our case here:

  1. I do not see a way to get info for specific Category but I have to retrieve a complete list which will end up being thousands of Categories as we grow.

  2. There is no way to segment Goals.getItemsCategory by referrerName

We love using Piwik and I am sure there is a way to make this work that I am missing, but I do need your help. Any ideas?

Thank you!

  1. you can use the “search filter_pattern etc.” see doc:
    It should work, but still will be slow if you have thousands of unique categories, since piwik stores the full dataset in the same archive…

    1. There is no way to segment Goals.getItemsCategory by referrerName
      Why ? it should work I think?
  1. Thanks for pointing me to filter_column / _pattern that works great for getting back a category I need. Is there a way to use multiple filters as filter_column[0…n]? Could not find it in the docs and trying it out only a single filter is used

  2. segment is not checked for in Goals.getItemsCategory from what I can see and I did not expect it to work since there is nothing in the docs about segment for this API method.

Any ideas on how to work around that? Ultimately I need to get visits and revenues for Category filtered by Category label, referrerName and a customVariable


Yes, I read that but Goals.getItemsCategory ignores segmentation variables

For example:

Returns the same numbers regardless of what referrerName equals to. Any ideas?

fedor thanks for the report, indeed segment is not currently implemented in Goals.getItems* but it should. I created a ticket: Add support for segmentation on Goals.getItems* API · Issue #2781 · matomo-org/matomo · GitHub

Is there a way to use multiple filters as filter_column[0…n]?

No you can only filter rows. Columns must be filtered in your code

Happy New Year! If you are still using Piwik and interested in the awesome new feature of “Creating a Custom Segment in Piwik and apply to reports in Real time!” we need YOUR help, with a little or big donation at:

This will allow to dynamically add or edit, a new set of rules for example “Show all visitors from USA and using Firefox and using Google”. This will be done via a simple to use interface. See screenshots and more info here:

We are crowd funding the future of Piwik and this feature in particular. With your help we can do it.