Custom Variables in the URL

I have inbound URLs that have values that I would like to track as variables.

For example, an external web site sends over a customer to me at:


How can I run a report showing how many visitors came in from “SomeAffiliate” but in the “Shoes” category?

Am I asking too much of Piwik or can this be done? The only examples I am seeing set variables in the Piwik javascript on the server.


of course it can be done :wink: you need to track campaigns: Tracking Campaigns – Analytics Piwik - Analytics Platform - Matomo

and “customize” the campaign parameters to automatically detect your params Category as campaign name, and Source as campaign keyword

Ok, I got it working.

The question is reporting:

I am able to see the results in the Piwik UI, but when I attempt to export the data to a report (such as CSV format) I only get campaigns, not the associated keywords with the campaign.

Am I missing how to include keyword info in the campaign export report?


in the CSV URL, add &expanded=1

Or try &flat=1

I looked and expanded=1 was already there.

I added &flat=1 and got an error. I changed expanded=1 to flat=1 and got the same results.

No keyword information is being returned in the report.


I just checked and &flat=1 works for me. What error di you get?