API question: top 100 pages

Hi,
I was reading the API documentation. However I couldn’t really encounter a way of getting statistics on the most visited pages.

My idea is to get the nth (100, 500 for example) most visited pages the last 7 days.

Hi Kasper,

That’s easy, use the pages endpoint (API | Pirsch Documentation) and set the filter accordingly (API | Pirsch Documentation).

I also have an example using curl here: pirsch-api-statistics-example.md · GitHub This includes the steps to get a token and the domain ID.

In your case, the URL would look something like this:

https://api.pirsch.io/api/v1/statistics/page?id=INSERT_DASHBOARD_ID&from=2024-02-01&to=2024-02-07&limit=100

The limit is hard coded to 100, so you would need to run multiple queries using the offset field to query more than 100 pages. Also, you can check your browser tab on our dashboard to see the URL. The dashboard also just uses the API.

1 Like

The limit doesn’t seem hard-coded?
Thanks for the curl example (pretty easy to translate to PHP curl like this with ChatGPT)

Below gives me 200 results (I don’t mind, but since you said it’s capped to 100).
https://api.pirsch.io/api/v1/statistics/page?id={$dashboardId}&from={$sevenDaysAgo}&to={$currentDate}&limit=200

Hmm, maybe the documentation is outdated, or this is a bug. I’ll check.

The limit does indeed not apply. We’ll keep it like that for now.