How to retrieve PageViews for individual pages?


This may be a very simple question, but I did not find the same topic on exisitng forum questions.

Question 1) I just started using piwik, and got a request to track the overall page view for about 15 pages for our website, plus a breakdown of the page views for each of the 15 pages.

Can someone point me to the correct API calls to use? Sample code would be great, too, on what will be returned.

Can someone show me how to get this? I need the number of page views for “index.html”, “faq.html”, “company.html”,… - how do I specify this in the api call?

Update - I figured out how to use segment to get the page views for each page; plus this api call: VisitsSummary.getActions - like this:

…segment=pageUrl==" + HttpUtility.UrlDecode(page1Url)…

but this function is making 15 seperate api calls, and is slow. Is there a way to make 1 call and get all the page view numbers for 15 pages?

Also - I’m not sure if this will return the correct value - can someone confirm?

Question 2) if I use VisitsSummary.getActions, will this return just Pageviews? The documentation says “count of actions (page views & downloads & clicks on outlinks)”.



What you maybe wanna have a look at is the “label” URL parameter: Reporting API Reference: API Reference - Matomo Analytics (formerly Piwik Analytics) - Developer Docs - v3 . I think it can be used with any API. Also interesting might be “Actions.getPageUrl”.

Actions usually include pageviews, downloads, …

So… if I just want the number of page views, what should I use?

We want the report to be as accurate as possible.


I’d look into Action.getPageUrl or so but maybe just try some APIs and if you find something with nb_pageviews for a specific URL that’s what you want I think. Haven’t done it myself yet :slight_smile:

As thomas said, use ‘Actions.getPageUrl’ is the easiest way to get what you want

HI DEV did you solution ?How to retrieve PageViews for individual pages?
please share you motomo query …please