Getting page views for URL via API

Hi,

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:

http://website.com/piwik/index.php?module=API&method=Actions.getPageUrls&format=PHP&idSite=2&period=day&date=2014-01-10&flat=0&label=VARIABLEURL&token_auth=da4daa4d20a9fc90cfe3d12eecd44f5a&filter_limit=30

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?

Thanks

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(
            1,
            PiwikPeriod.RANGE,
            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,
Olivier

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