Manuel
Manuel

Reputation: 9522

Get hourly visitors statistics through Google / Piwik API

Is it possible to get hourly visitor stats per unique url from either piwik or google analytics api?

Upvotes: 0

Views: 1345

Answers (2)

Maciej Zawadziński
Maciej Zawadziński

Reputation: 1

You can get hourly local time/website time stats per unique URL by using Piwik segmentation API ( http://developer.piwik.org/api-reference/segmentation).

In order to do it, you query the VisitTime.getVisitInformationPerLocalTime (or VisitTime.getVisitInformationPerServerTime) and add a segment parameter for given URL:

&segment=pageUrl==http%3A%2F%2Fforum.piwik.org%2Fregister.php

Example call:

http://demo.piwik.org/index.php?module=API&method=VisitTime.getVisitInformationPerLocalTime&format=XML&idSite=7&period=day&date=yesterday&expanded=1&token_auth=anonymous&segment=pageUrl==http%3A%2F%2Fforum.piwik.org%2Fregister.php

You can find more about Piwik API at: http://developer.piwik.org/api-reference/reporting-api

Upvotes: 0

Eike Pierstorff
Eike Pierstorff

Reputation: 32760

Google Analytics has the hour, hour of the day (i.e. date + time) and index hour (counted from the beginning of the selected timeframe). You'll find this when you look in the "secondary dimension" dropdown in the "time" section (or in the custom reports) and you can query that via the API (ga:hour, ga:dateHour and ga:nthHour).

I'm not an expert with Piwik but could not find anything like in in their demo. Of course Piwik being open source you could possibly write a plugin that displays the hour. Last time I looked the database table had a timestamp.

Upvotes: 1

Related Questions