Piwik Analytics API

There are two main APIs in Piwik

  • Analytics API: used to request all Piwik reports and to manage (add, update, delete) websites, users, permissions, email reports, etc.
  • Tracking API: used to record data in Piwik using the JavaScript Code, or using the Tracking REST API (via PHP or Java client)

This page describes the Analytics API. You can use the Analytics API to programmatically request reports (number of visits, page URLs, page titles, user settings, search engines, keywords, referrer websites, user browsers, etc.) for a list of websites, and a given date and period (day, week, month, year). The data can be requested in any format: xml, csv, json, serialized php, etc.

Piwik also provides APIs to create, edit and delete websites, users, user privileges, goals and PDF reports. Many users are using the API to automatically provide Piwik to their customers (see for example, the beta release of Signup plugin).

Learn more in the Piwik API documentation pages:

  • Tutorial: Fetch The Top 10 Keywords
    Get started with this simple tutorial
  • Piwik API Reference
    Lists of all Piwik API functions, list of standard and optional parameters, and more
  • Piwik Metadata API.
    Use the Metadata API to retrieve enriched data (translated labels, column names, report category, etc.)
  • Piwik Segmentation in the API
    Learn how to request Piwik reports filtered to a segment of visits.
  • How to call the Piwik API?
    Learn about the two methods of calling the API: using the REST API over HTTP, or loading the Piwik PHP files directly in your app.
  • Include Static PNG Graphs
    It is easy to include dynamic PNG Graphs plotting any metric or report. The Static PNG Graphs API can be used on any HTML page, or desktop/Mobile App. It is used to draw graphs in Piwik Mobile
  • Real time Analytics API via the Live! API
    The Live! API is the API provided by the Live! plugin, which lets you access 1) real time counters, 2) individual visit sessions and pages, as well as their converted goals, custom variables and all other the data about your visits.
  • In the API page in your Piwik server
    On the top of the Piwik user interface, the link API will show you the list of API functions and URLs, as well as your token_auth. See the API page on the Piwik demo.

If you are familiar with the Analytics API, and wish to track Mobile App (or Desktop App) Analytics with Piwik, check out this blog post (Advanced users only): How to track Mobile apps usage (clicks, phones, errors, etc.) or track software analytics

Feedback on this page

Have you found an error in this page, or do you think some information is missing or not clear? We appreciate you taking the time to send us your suggestions and feedback on this page.