Getting page views for URL via API


I’ve just started using Piwik and I’d like to use the API to display how many page views a given page has had over a period. I currently have this URL:

I would like to insert a PHP variable into that URL to specify the page I’d like the stats for. Unfortunately, the label seems to be “Folder > Page” rather than a standard URL.

How do I go about querying via URL, not folder > page?


Use the API Actions.getPageUrl there is for it a parameter for the URL (it’s basically a shortcut version calling getPageUrls)

Hi Matthieu,
I’m trying to get stats per page (view, visitors, coutry, …). In my AspNet MVC project I’m using the nuget package Piwik.Analytics v0.2.0.
I have the following method (from samples):

        var results = (ArrayList)actions.getPageUrls(
            new AbsoluteRangeDate(DateTime.Now.AddDays(-30), DateTime.Now)

But I don’t see the parameter for the URL.

Thanks in advance for your help/suggestions,

You are using the wrong call. If you look at the documentation there are two calls - one is plural. The singular version (getPageUrl) has the following:

Actions.getPageUrl (pageUrl, idSite, period, date, segment = '')

As you can see the first parameter is the Page URL.

1 Like