This is the Piwik API Reference. It lists all functions that can be called, documents the parameters, and links to examples for every call in the various formats.
API Request
Standard API parameters
- idSite
- the integer id of your website, eg. idSite=1
- you can also specify a list of idSites comma separated, eg. idSite=1,4,5,6
- if you want to get data for all websites, set idSite=all
- period; the period you request the statistics for. Can be any of: day, week, month, year or range. All reports are returned for the dates based on the website’s time zone.
- ‘day’ returns data for a given day.
- ‘week’ returns data for the week that contains the specified ‘date’
- ‘month’ returns data for the month that contains the specified ‘date’
- ‘year’ returns data for the year that contains the specified ‘date’
- ‘range’ returns data for the specified ‘date’ range.
For example to request a report for the range Jan 1st to Feb 15th you would write &period=range&date=2011-01-01,2011-02-15
- date
- standard format = YYYY-MM-DD
- magic keywords = today or yesterday. These are relative the website timezone. For example, for a website with UTC+12 timezone, “date=today” for an API request at 5PM UTC on 2010-01-01 will return the reports for 2010-01-02.
- range of dates
- lastX for the last X periods including today (eg &date=last10&period=day would return an entry for each of the last 10 days including today). This is relative to the website timezone.
- previousX returns the last X periods before today (eg. &date=last52&period=week will return an entry for each of the 52 weeks before this week). This is relative to the website timezone.
- YYYY-MM-DD,YYYY-MM-DD for every period (day, week, month or year) in the date range
- Note: if you set ‘period=range’ to request data for a custom date range, the API will return the sum of data for the specified date range.
When ‘period=range’, the following keywords are supported for the parameter ‘date’:
- lastX
- previousX
- YYYY-MM-DD,YYYY-MM-DD, or YYYY-MM-DD,today or YYYY-MM-DD,yesterday
- segment; defines the Custom Segment you wish to filter your reports to.
- format; defines the format of the output
- xml
- json (if you want to do cross domain request in ajax and get json data, you can wrap the json data around a function call by using the jsoncallback parameter)
- csv (comma-separated values)
- tsv (tab-separated values, similar to CSV but loads properly in Excel)
- html
- php; when you export in PHP format it is serialized by default (set serialize=0 to get the raw php data structure). You can have a visual output of the data by setting prettyDisplay=1
- rss (when date is a range for example date=last10 or date=previous15)
- original; to fetch the original PHP data structure. This is useful when you call the Piwik API internally using the PHP code
Optional API parameters
Each API call can contain parameters that do not appear in the list of parameters, but act as “filters”. Filters can be presentation filters (eg. specify the language for internationalization), or act as data helpers (sort results, search for a dataset subset, fetch children of a given entity).
Here is an overview of the parameters you can add to any API request, where applicable:
- language; if specified, returns data strings that can be internationalized and will be translated. For example, dates and times returned by the Live API can be translated into the specified language. Expected value is the 2 language letters code, eg. en, fr, de, es, etc. You can get the available list of language by calling the LanguagesManager API.
- idSubtable is used to request a subtable of a given row. In Piwik, some rows are linked to a sub-table. For example, each row in the Referers.getSearchEngines response have an “idsubdatatable” field. This integer idsubdatatable is the idSubtable of the table that contains all keywords for this search engine. You can then request the keywords for this search engine by calling Referers.getKeywordsFromSearchEngineId with the parameter idSubtable=X (replace X with the idsubdatatable value found in the Referers.getSearchEngines response, for the search engine you are interested in).
- expanded; some API functions have a parameter ‘expanded’. If ‘expanded’ is set to 1, the returned data will contain the first level results, as well as all sub-tables. See, for example, the returned dataset for the Actions.getDownloads API function.
- flat; some API functions have a parameter ‘expanded’, which means that the data is hierarchical. For such API function, if ‘flat’ is set to 1, the returned data will contain the flattened view of the table data set. The children of all first level rows will be aggregated under one row. This is useful for example to see all Custom Variables names and values at once, for example, Piwik forum user status, or to see the full URLs not broken down by directory or structure.
- label; this parameter can be used to search only for the row matching a given label. When specified, the report data will be filtered and return only the rows where the row label matches the specified parameter. For example you can set &label=Nice%20Keyword to keep only the row with a label “Nice Keyword”.
There are also generic filters you can choose to apply on all APIs that return web analytics reports. For example, there is a filter for sorting by column, define start and number of rows to return, a filter to only return rows matching a given string,
- filter_offset; defines the offset of the starting row being returned
- filter_limit; defines the number of rows to be returned. Set to -1 to return all rows. By default, only the top 100 rows are returned.
- filter_truncate; if set, will truncate the table after $filter_truncate rows. The last row will be named ‘Others’ (localized in the requested language) and the columns will be an aggregate of statistics of all truncated rows.
- filter_pattern; defines the text you want to search for in the filter_column. Only the row with the given column matching the pattern will be returned.
- filter_column ; defines the column that we want to search for a text (see filter_pattern). If not specified, defaults to ‘label’ (from Piwik 1.7)
- filter_sort_order; defines the order of the results, asc or desc
- filter_sort_column; defines the column to be sorted by
- filter_excludelowpop; defines the column to use for the threshold of value filter_excludelowpop_value; only the columns with a value greater than filter_excludelowpop_value; will be returned
- filter_excludelowpop_value; defines the minimum value for the filter_excludelowpop column
- hideColumns; a comma separated list of columns. If set, removes those columns from the result. This can be used to reduce the amount of data transferred.
- showColumns; a comma separated list of columns. If set, removes all columns in the result that are not found in this list. This can be used to reduce the amount of data transferred.
- filter_column_recursive; defines the column to be searched for when recursively searching for a pattern filter_pattern_recursive
- filter_pattern_recursive; defines the text you are searching for. Only the matching rows are returned. This filter is applied to recursive tables (Actions/Downloads/Outlinks tables)
- disable_generic_filters; if set to 1, all the generic filters above will not be applied. This can be useful to disable the filters above which are otherwise applied with default values.
- disable_queued_filters; if set to 1, all the filters that are mostly presentation filters (replace a column name, apply callbacks on the column to add new information such as the browser icon URL, etc.) will not be applied.
Passing an array of data as a parameter
Some parameters can optionally accept arrays. For example, the urls parameter of SitesManager.addSite, SitesManager.addSiteAliasUrls, and SitesManager.updateSite allows for an array of urls to be passed. To pass an array add the bracket operators and an index to the parameter name in the get request. So, to call SitesManager.addSite with two urls you would use the following array:
http://demo.piwik.org/?module=API&method=SitesManager.addSite&siteName=new%20example%20website&urls[0]=http://example.org&urls[1]=http://example-alias.org
Advanced Users: Send multiple API Requests at once
Sometimes it is necessary to call the Piwik API a few times to get the data needed for a report or custom application. When you need to call many API functions simultaneously or if you just don’t want to issue a lot of HTTP requests, you may want to consider using a Bulk API Request. This feature allows you to call several API methods with one HTTP request (either a GET or POST).
To issue a bulk request, call the API.getBulkRequest method and pass the API methods & parameters (each request must be URL Encoded) you wish to call in the ‘urls’ query parameter. For example, to call VisitsSummary.get & VisitorInterest.getNumberOfVisitsPerVisitDuration at the same time, you can use:
http://demo.piwik.org/?module=API&method=API.getBulkRequest&urls[0]=method%3dVisitsSummary.get%26idSite%3d1%26date%3d2012-03-06%26format%3djson%26period%3dday&urls[1]=method%3dVisitorInterest.getNumberOfVisitsPerVisitDuration%26idSite%3d1%26date%3d2012-03-06%26format%3djson%26period%3dday
Notice that urls[0] is the url-encoded call to VisitsSummary.get by itself and that urls[1] is what you would use to call VisitorInterest.getNumberOfVisitsPerVisitDuration by itself.
The API Response will be an array containing the formatted result of each individual API method, in this case VisitsSummary.get and VisitorInterest.getNumberOfVisitsPerVisitDuration.
Authenticate to the API via token_auth parameter
In the example above, the request works because the statistics are public (the anonymous user has a view access to the website). By default in Piwik your statistics are private. In the case that you cannot have your statistics to be public:
- when you access your Piwik installation you are requested to log in
- when you call the API over http you need to authenticate yourself
This is done by adding a secret parameter in the URL. This parameter is as secret as your login and password!
You can get this token in the Manage Users admin area.
Then you simply have to add the parameter &token_auth=YOUR_TOKEN at the end of your API call URL.
API Response: Metric Definitions
Here is a list of metrics returned by the API and their definition.
General Metrics
- nb_uniq_visitors – Number of unique visitors
- nb_visits – Number of Visits (30 min of inactivity considered a new visit)
- nb_actions – Number of actions (page views, outlinks and downloads)
- sum_visit_length – Total time spent, in seconds
- bounce_count – Number of visits that bounced (viewed only one page)
- max_actions – Maximum number of actions in a visit
- nb_visits_converted – Number of visits that converted a goal
- nb_conversions – Number of goal conversions
- revenue – Total revenue of goal conversions
Metrics Specific to Page URLs and Page Titles Reports
- nb_hits – Number of views on this page
- entry_nb_visits – Number of visits that started on this page
- entry_nb_uniq_visitors – Number of unique visitors that started their visit on this page
- entry_nb_actions – Number of page views for visits that started on this page
- entry_sum_visit_length – Time spent, in seconds, by visits that started on this page
- entry_bounce_count – Number of visits that started on this page, and bounced (viewed only one page)
- exit_nb_visits – Number of visits that finished on this page
- exit_nb_uniq_visitors – Number of unique visitors that ended their visit on this page
- sum_time_spent – Total time spent on this page, in seconds
- sum_daily_nb_uniq_visitors – Sum of daily unique visitors over days in the period. Piwik doesn’t process unique visitors across the full period.
- sum_daily_entry_nb_uniq_visitors – Sum of daily unique visitors that started their visit on this page
- sum_daily_exit_nb_uniq_visitors – (deprecated) Same as sum_daily_entry_nb_uniq_visitors
- exit_bounce_count – (deprecated) Same as entry_bounce_count
Processed metrics, appearing in the Metadata API response
- avg_time_on_page – Average time spent, in seconds, on this page
- bounce_rate – Ratio of visitors leaving the website after landing on this page
- exit_rate – Ratio of visitors that do not view any other page after this page
Ecommerce metrics, appearing in the Ecommerce Goals.getItems* API calls only:
- revenue – The total revenue generated by Product sales. Excludes tax, shipping and discount.
- quantity – Quantity is the total number of products sold for each Product SKU/Name/Category.
- orders – It is the total number of Ecommerce orders which contained this Product SKU/Name/Category at least once.
- abandoned_carts – This value is only set if the request contains ‘&abandonedCarts=1′. In this case, “orders” metrics will not be returned. It is the total number of abandoned carts which contained this Product SKU/Name/Category at least once.
- avg_price – The average revenue for this Product/Category.
- avg_quantity – The average quantity for this Product/Category.
- nb_visits – This value appears only if you have set up ‘Ecommerce Product/Category page tracking’. The number of visits on the Product/Category page.
- conversion_rate – This value appears only if you have set up ‘Ecommerce Product/Category page tracking’. The conversion rate is the number of orders (or abandoned_carts if the request contains ‘&abandonedCarts=1′) containing this product/category divided by number of visits on the product/category page.
List of Piwik API methods, grouped by plugin
Quick access to APIs
APIActionsAnnotationsCustomVariablesDashboardExampleAPIFeedAnnotationGoalsImageGraphLanguagesManagerLiveMobileMessagingMultiSitesOverlayPDFReportsProviderReferersSEOSegmentEditorSitesManagerTransitionsUserCountryUserSettingsUsersManagerVisitFrequencyVisitTimeVisitorInterestVisitsSummary
Module API
This API is the
Metadata API: it gives information about all other available APIs methods, as well as providing human readable and more complete outputs than normal API methods. Some of the information that is returned by the Metadata API:
- the dynamically generated list of all API methods via "getReportMetadata"
- the list of metrics that will be returned by each method, along with their human readable name, via "getDefaultMetrics" and "getDefaultProcessedMetrics"
- the list of segments metadata supported by all functions that have a 'segment' parameter
- the (truly magic) method "getProcessedReport" will return a human readable version of any other report, and include the processed metrics such as conversion rate, time on site, etc. which are not directly available in other methods.
- the method "getSuggestedValuesForSegment" returns top suggested values for a particular segment. It uses the Live.getLastVisitsDetails API to fetch the most recently used values, and will return the most often used values first.
The Metadata API is for example used by the Piwik Mobile App to automatically display all Piwik reports, with translated report & columns names and nicely formatted values. More information on the
Metadata API documentation page
-
API.getMetadata (idSite, apiModule, apiAction, apiParameters = 'Array', language = '', period = '', date = '', hideMetricsDoc = '', showSubtableReports = '')
[ Example in
XML,
Json,
Tsv (Excel)
, RSS of the last 10 days
]
-
API.getReportMetadata (idSites = '', period = '', date = '', hideMetricsDoc = '', showSubtableReports = '')
[ Example in
XML,
Json,
Tsv (Excel)
, RSS of the last 10 days
]
-
API.getProcessedReport (idSite, period, date, apiModule, apiAction, segment = '', apiParameters = '', idGoal = '', language = '', showTimer = '1', hideMetricsDoc = '', idSubtable = '', showRawMetrics = '')
[ Example in
XML,
Json,
Tsv (Excel)
, RSS of the last 10 days
]
-
API.getRowEvolution (idSite, period, date, apiModule, apiAction, label = '', segment = '', column = '', language = '', idGoal = '', legendAppendMetric = '1', labelUseAbsoluteUrl = '1')
[ Example in
XML,
Json,
Tsv (Excel)
, RSS of the last 10 days
]
- API.getBulkRequest (urls) [ No example available ]
- API.getSuggestedValuesForSegment (segmentName, idSite) [ No example available ]
Module Actions
The Actions API lets you request reports for all your Visitor Actions: Page URLs, Page titles (Piwik Events), File Downloads and Clicks on external websites. For example, "getPageTitles" will return all your page titles along with standard
Actions metrics for each row. It is also possible to request data for a specific Page Title with "getPageTitle" and setting the parameter pageName to the page title you wish to request. Similarly, you can request metrics for a given Page URL via "getPageUrl", a Download file via "getDownload" and an outlink via "getOutlink". Note: pageName, pageUrl, outlinkUrl, downloadUrl parameters must be URL encoded before you call the API.
-
Actions.get (idSite, period, date, segment = '', columns = '')
[ Example in
XML,
Json,
Tsv (Excel)
, RSS of the last 10 days
]
-
Actions.getPageUrls (idSite, period, date, segment = '', expanded = '', idSubtable = '')
[ Example in
XML,
Json,
Tsv (Excel)
, RSS of the last 10 days
]
-
Actions.getPageUrlsFollowingSiteSearch (idSite, period, date, segment = '', expanded = '', idSubtable = '')
[ Example in
XML,
Json,
Tsv (Excel)
, RSS of the last 10 days
]
-
Actions.getPageTitlesFollowingSiteSearch (idSite, period, date, segment = '', expanded = '', idSubtable = '')
[ Example in
XML,
Json,
Tsv (Excel)
, RSS of the last 10 days
]
-
Actions.getEntryPageUrls (idSite, period, date, segment = '', expanded = '', idSubtable = '')
[ Example in
XML,
Json,
Tsv (Excel)
, RSS of the last 10 days
]
-
Actions.getExitPageUrls (idSite, period, date, segment = '', expanded = '', idSubtable = '')
[ Example in
XML,
Json,
Tsv (Excel)
, RSS of the last 10 days
]
- Actions.getPageUrl (pageUrl, idSite, period, date, segment = '') [ No example available ]
-
Actions.getPageTitles (idSite, period, date, segment = '', expanded = '', idSubtable = '')
[ Example in
XML,
Json,
Tsv (Excel)
, RSS of the last 10 days
]
-
Actions.getEntryPageTitles (idSite, period, date, segment = '', expanded = '', idSubtable = '')
[ Example in
XML,
Json,
Tsv (Excel)
, RSS of the last 10 days
]
-
Actions.getExitPageTitles (idSite, period, date, segment = '', expanded = '', idSubtable = '')
[ Example in
XML,
Json,
Tsv (Excel)
, RSS of the last 10 days
]
- Actions.getPageTitle (pageName, idSite, period, date, segment = '') [ No example available ]
-
Actions.getDownloads (idSite, period, date, segment = '', expanded = '', idSubtable = '')
[ Example in
XML,
Json,
Tsv (Excel)
, RSS of the last 10 days
]
- Actions.getDownload (downloadUrl, idSite, period, date, segment = '') [ No example available ]
-
Actions.getOutlinks (idSite, period, date, segment = '', expanded = '', idSubtable = '')
[ Example in
XML,
Json,
Tsv (Excel)
, RSS of the last 10 days
]
- Actions.getOutlink (outlinkUrl, idSite, period, date, segment = '') [ No example available ]
-
Actions.getSiteSearchKeywords (idSite, period, date, segment = '')
[ Example in
XML,
Json,
Tsv (Excel)
, RSS of the last 10 days
]
-
Actions.getSiteSearchNoResultKeywords (idSite, period, date, segment = '')
[ Example in
XML,
Json,
Tsv (Excel)
, RSS of the last 10 days
]
-
Actions.getSiteSearchCategories (idSite, period, date, segment = '')
[ Example in
XML,
Json,
Tsv (Excel)
, RSS of the last 10 days
]
Module Annotations
API for annotations plugin. Provides methods to create, modify, delete & query annotations.
- Annotations.add (idSite, date, note, starred = '0') [ No example available ]
- Annotations.save (idSite, idNote, date = '', note = '', starred = '') [ No example available ]
- Annotations.delete (idSite, idNote) [ No example available ]
- Annotations.get (idSite, idNote) [ No example available ]
-
Annotations.getAll (idSite, date = '', period = 'day', lastN = '')
[ Example in
XML,
Json,
Tsv (Excel)
, RSS of the last 10 days
]
-
Annotations.getAnnotationCountForDates (idSite, date, period, lastN = '', getAnnotationText = '')
[ Example in
XML,
Json,
Tsv (Excel)
, RSS of the last 10 days
]
Module CustomVariables
The Custom Variables API lets you access reports for your
Custom Variables names and values.
-
CustomVariables.getCustomVariables (idSite, period, date, segment = '', expanded = '')
[ Example in
XML,
Json,
Tsv (Excel)
, RSS of the last 10 days
]
- CustomVariables.getCustomVariablesValuesFromNameId (idSite, period, date, idSubtable, segment = '') [ No example available ]
Module Dashboard
This API is the
Dashboard API: it gives information about dashboards.
Module ExampleAPI
Module FeedAnnotation
FeedAnnotation API is used to request the configured Feed Annotation URLs.
- FeedAnnotation.getFeed (idFeed) [ No example available ]
Module Goals
Goals API lets you Manage existing goals, via "updateGoal" and "deleteGoal", create new Goals via "addGoal", or list existing Goals for one or several websites via "getGoals" If you are
tracking Ecommerce orders and products on your site, the functions "getItemsSku", "getItemsName" and "getItemsCategory" will return the list of products purchased on your site, either grouped by Product SKU, Product Name or Product Category. For each name, SKU or category, the following metrics are returned: Total revenue, Total quantity, average price, average quantity, number of orders (or abandoned carts) containing this product, number of visits on the Product page, Conversion rate. By default, these functions return the 'Products purchased'. These functions also accept an optional parameter &abandonedCarts=1. If the parameter is set, it will instead return the metrics for products that were left in an abandoned cart therefore not purchased. The API also lets you request overall Goal metrics via the method "get": Conversions, Visits with at least one conversion, Conversion rate and Revenue. If you wish to request specific metrics about Ecommerce goals, you can set the parameter &idGoal=ecommerceAbandonedCart to get metrics about abandoned carts (including Lost revenue, and number of items left in the cart) or &idGoal=ecommerceOrder to get metrics about Ecommerce orders (number of orders, visits with an order, subtotal, tax, shipping, discount, revenue, items ordered) See also the documentation about
Tracking Goals in Piwik.
- Goals.addGoal (idSite, name, matchAttribute, pattern, patternType, caseSensitive = '', revenue = '', allowMultipleConversionsPerVisit = '') [ No example available ]
- Goals.updateGoal (idSite, idGoal, name, matchAttribute, pattern, patternType, caseSensitive = '', revenue = '', allowMultipleConversionsPerVisit = '') [ No example available ]
- Goals.deleteGoal (idSite, idGoal) [ No example available ]
-
Goals.getItemsSku (idSite, period, date, abandonedCarts = '')
[ Example in
XML,
Json,
Tsv (Excel)
, RSS of the last 10 days
]
-
Goals.getItemsName (idSite, period, date, abandonedCarts = '')
[ Example in
XML,
Json,
Tsv (Excel)
, RSS of the last 10 days
]
-
Goals.getItemsCategory (idSite, period, date, abandonedCarts = '')
[ Example in
XML,
Json,
Tsv (Excel)
, RSS of the last 10 days
]
-
Goals.get (idSite, period, date, segment = '', idGoal = '', columns = 'Array')
[ Example in
XML,
Json,
Tsv (Excel)
, RSS of the last 10 days
]
-
Goals.getDaysToConversion (idSite, period, date, segment = '', idGoal = '')
[ Example in
XML,
Json,
Tsv (Excel)
, RSS of the last 10 days
]
-
Goals.getVisitsUntilConversion (idSite, period, date, segment = '', idGoal = '')
[ Example in
XML,
Json,
Tsv (Excel)
, RSS of the last 10 days
]
Module ImageGraph
The ImageGraph.get API call lets you generate beautiful static PNG Graphs for any existing Piwik report. Supported graph types are: line plot, 2D/3D pie chart and vertical bar chart. A few notes about some of the parameters available:
- $graphType defines the type of graph plotted, accepted values are: 'evolution', 'verticalBar', 'pie' and '3dPie'
- $colors accepts a comma delimited list of colors that will overwrite the default Piwik colors
- you can also customize the width, height, font size, metric being plotted (in case the data contains multiple columns/metrics). See also
How to embed static Image Graphs? for more information.
-
ImageGraph.get (idSite, period, date, apiModule, apiAction, graphType = '', outputType = '0', columns = '', labels = '', showLegend = '1', width = '', height = '', fontSize = '9', legendFontSize = '', aliasedGraph = '1', idGoal = '', colors = '', textColor = '222222', backgroundColor = 'FFFFFF', gridColor = 'CCCCCC', idSubtable = '', legendAppendMetric = '1')
[ Example in
XML,
Json,
Tsv (Excel)
, RSS of the last 10 days
]
Module LanguagesManager
The LanguagesManager API lets you access existing Piwik translations, and change Users languages preferences. "getTranslationsForLanguage" will return all translation strings for a given language, so you can leverage Piwik translations in your application (and automatically benefit from the
40+ translations!). This is mostly useful to developers who integrate Piwik API results in their own application. You can also request the default language to load for a user via "getLanguageForUser", or update it via "setLanguageForUser".
-
LanguagesManager.isLanguageAvailable (languageCode)
[ Example in
XML,
Json,
Tsv (Excel)
]
-
LanguagesManager.getTranslationsForLanguage (languageCode)
[ Example in
XML,
Json,
Tsv (Excel)
]
- LanguagesManager.getLanguageForUser (login) [ No example available ]
- LanguagesManager.setLanguageForUser (login, languageCode) [ No example available ]
Module Live
The Live! API lets you access complete visit level information about your visitors. Combined with the power of
Segmentation, you will be able to request visits filtered by any criteria. The method "getLastVisitsDetails" will return extensive data for each visit, which includes: server time, visitId, visitorId, visitorType (new or returning), number of pages, list of all pages (and events, file downloaded and outlinks clicked), custom variables names and values set to this visit, number of goal conversions (and list of all Goal conversions for this visit, with time of conversion, revenue, URL, etc.), but also other attributes such as: days since last visit, days since first visit, country, continent, visitor IP, provider, referrer used (referrer name, keyword if it was a search engine, full URL), campaign name and keyword, operating system, browser, type of screen, resolution, supported browser plugins (flash, java, silverlight, pdf, etc.), various dates & times format to make it easier for API users... and more! With the parameter
'&segment=' you can filter the returned visits by any criteria (visitor IP, visitor ID, country, keyword used, time of day, etc.). The method "getCounters" is used to return a simple counter: visits, number of actions, number of converted visits, in the last N minutes. See also the documentation about
Real time widget and visitor level reports in Piwik.
-
Live.getCounters (idSite, lastMinutes, segment = '')
[ Example in
XML,
Json,
Tsv (Excel)
]
-
Live.getLastVisitsDetails (idSite, period, date, segment = '', filter_limit = '', filter_offset = '', minTimestamp = '', flat = '', doNotFetchActions = '')
[ Example in
XML,
Json,
Tsv (Excel)
, RSS of the last 10 days
]
Module MobileMessaging
The MobileMessaging API lets you manage and access all the MobileMessaging plugin features including : - manage SMS API credential - activate phone numbers - check remaining credits - send SMS
- MobileMessaging.setSMSAPICredential (provider, apiKey) [ No example available ]
- MobileMessaging.addPhoneNumber (phoneNumber) [ No example available ]
- MobileMessaging.removePhoneNumber (phoneNumber) [ No example available ]
- MobileMessaging.validatePhoneNumber (phoneNumber, verificationCode) [ No example available ]
- MobileMessaging.setDelegatedManagement (delegatedManagement) [ No example available ]
Module MultiSites
The MultiSites API lets you request the key metrics (visits, page views, revenue) for all Websites in Piwik.
-
MultiSites.getAll (period, date, segment = '', enhanced = '', pattern = '')
[ Example in
XML,
Json,
Tsv (Excel)
, RSS of the last 10 days
]
-
MultiSites.getOne (idSite, period, date, segment = '', enhanced = '')
[ Example in
XML,
Json,
Tsv (Excel)
, RSS of the last 10 days
]
Module Overlay
Piwik - Open source web analytics @link http://piwik.org @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later @category Piwik_Plugins
-
Overlay.getFollowingPages (url, idSite, period, date, segment = '')
[ Example in
XML,
Json,
Tsv (Excel)
, RSS of the last 10 days
]
Module PDFReports
The PDFReports API lets you manage Scheduled Email reports, as well as generate, download or email any existing report. "generateReport" will generate the requested report (for a specific date range, website and in the requested language). "sendEmailReport" will send the report by email to the recipients specified for this report. You can also get the list of all existing reports via "getReports", create new reports via "addReport", or manage existing reports with "updateReport" and "deleteReport". See also the documentation about
Scheduled Email reports in Piwik.
- PDFReports.addReport (idSite, description, period, hour, reportType, reportFormat, reports, parameters) [ No example available ]
- PDFReports.updateReport (idReport, idSite, description, period, hour, reportType, reportFormat, reports, parameters) [ No example available ]
- PDFReports.deleteReport (idReport) [ No example available ]
-
PDFReports.getReports (idSite = '', period = '', idReport = '', ifSuperUserReturnOnlySuperUserReports = '')
[ Example in
XML,
Json,
Tsv (Excel)
, RSS of the last 10 days
]
- PDFReports.generateReport (idReport, date, language = '', outputType = '', period = '', reportFormat = '', parameters = '') [ No example available ]
- PDFReports.sendReport (idReport, period = '', date = '') [ No example available ]
Module Provider
The Provider API lets you access reports for your visitors Internet Providers.
Module Referers
The Referrers API lets you access reports about Websites, Search engines, Keywords, Campaigns used to access your website. For example, "getKeywords" returns all search engine keywords (with
general analytics metrics for each keyword), "getWebsites" returns referrer websites (along with the full Referrer URL if the parameter &expanded=1 is set). "getRefererType" returns the Referrer overview report. "getCampaigns" returns the list of all campaigns (and all campaign keywords if the parameter &expanded=1 is set). The methods "getKeywordsForPageUrl" and "getKeywordsForPageTitle" are used to output the top keywords used to find a page. Check out the widget
"Top keywords used to find this page" that you can easily re-use on your website.
-
Referers.getRefererType (idSite, period, date, segment = '', typeReferer = '', idSubtable = '', expanded = '')
[ Example in
XML,
Json,
Tsv (Excel)
, RSS of the last 10 days
]
-
Referers.getKeywords (idSite, period, date, segment = '', expanded = '')
[ Example in
XML,
Json,
Tsv (Excel)
, RSS of the last 10 days
]
- Referers.getKeywordsForPageTitle (idSite, period, date, title) [ No example available ]
- Referers.getSearchEnginesFromKeywordId (idSite, period, date, idSubtable, segment = '') [ No example available ]
-
Referers.getSearchEngines (idSite, period, date, segment = '', expanded = '')
[ Example in
XML,
Json,
Tsv (Excel)
, RSS of the last 10 days
]
- Referers.getKeywordsFromSearchEngineId (idSite, period, date, idSubtable, segment = '') [ No example available ]
-
Referers.getCampaigns (idSite, period, date, segment = '', expanded = '')
[ Example in
XML,
Json,
Tsv (Excel)
, RSS of the last 10 days
]
- Referers.getKeywordsFromCampaignId (idSite, period, date, idSubtable, segment = '') [ No example available ]
-
Referers.getWebsites (idSite, period, date, segment = '', expanded = '')
[ Example in
XML,
Json,
Tsv (Excel)
, RSS of the last 10 days
]
- Referers.getUrlsFromWebsiteId (idSite, period, date, idSubtable, segment = '') [ No example available ]
-
Referers.getSocials (idSite, period, date, segment = '', expanded = '')
[ Example in
XML,
Json,
Tsv (Excel)
, RSS of the last 10 days
]
-
Referers.getUrlsForSocial (idSite, period, date, segment = '', idSubtable = '')
[ Example in
XML,
Json,
Tsv (Excel)
, RSS of the last 10 days
]
-
Referers.getNumberOfDistinctSearchEngines (idSite, period, date, segment = '')
[ Example in
XML,
Json,
Tsv (Excel)
, RSS of the last 10 days
]
-
Referers.getNumberOfDistinctKeywords (idSite, period, date, segment = '')
[ Example in
XML,
Json,
Tsv (Excel)
, RSS of the last 10 days
]
-
Referers.getNumberOfDistinctCampaigns (idSite, period, date, segment = '')
[ Example in
XML,
Json,
Tsv (Excel)
, RSS of the last 10 days
]
-
Referers.getNumberOfDistinctWebsites (idSite, period, date, segment = '')
[ Example in
XML,
Json,
Tsv (Excel)
, RSS of the last 10 days
]
-
Referers.getNumberOfDistinctWebsitesUrls (idSite, period, date, segment = '')
[ Example in
XML,
Json,
Tsv (Excel)
, RSS of the last 10 days
]
Module SEO
The SEO API lets you access a list of SEO metrics for the specified URL: Google Pagerank, Goolge/Bing indexed pages Alexa Rank, age of the Domain name and count of DMOZ entries.
Module SegmentEditor
The SegmentEditor API lets you add, update, delete custom Segments, and list saved segments.
- SegmentEditor.delete (idSegment) [ No example available ]
- SegmentEditor.update (idSegment, name, definition, idSite = '', autoArchive = '', enabledAllUsers = '') [ No example available ]
- SegmentEditor.add (name, definition, idSite = '', autoArchive = '', enabledAllUsers = '') [ No example available ]
- SegmentEditor.get (idSegment) [ No example available ]
-
SegmentEditor.getAll (idSite = '', returnOnlyAutoArchived = '')
[ Example in
XML,
Json,
Tsv (Excel)
]
Module SitesManager
The SitesManager API gives you full control on Websites in Piwik (create, update and delete), and many methods to retrieve websites based on various attributes. This API lets you create websites via "addSite", update existing websites via "updateSite" and delete websites via "deleteSite". When creating websites, it can be useful to access internal codes used by Piwik for currencies via "getCurrencyList", or timezones via "getTimezonesList". There are also many ways to request a list of websites: from the website ID via "getSiteFromId" or the site URL via "getSitesIdFromSiteUrl". Often, the most useful technique is to list all websites that are known to a current user, based on the token_auth, via "getSitesWithAdminAccess", "getSitesWithViewAccess" or "getSitesWithAtLeastViewAccess" (which returns both). Some methods will affect all websites globally: "setGlobalExcludedIps" will set the list of IPs to be excluded on all websites, "setGlobalExcludedQueryParameters" will set the list of URL parameters to remove from URLs for all websites. The existing values can be fetched via "getExcludedIpsGlobal" and "getExcludedQueryParametersGlobal". See also the documentation about
Managing Websites in Piwik.
-
SitesManager.getJavascriptTag (idSite, piwikUrl = '')
[ Example in
XML,
Json,
Tsv (Excel)
]
- SitesManager.getSitesFromGroup (group) [ No example available ]
-
SitesManager.getSitesIdWithVisits (timestamp = '')
[ Example in
XML,
Json,
Tsv (Excel)
]
-
SitesManager.getSitesWithAtLeastViewAccess (limit = '')
[ Example in
XML,
Json,
Tsv (Excel)
]
- SitesManager.addSite (siteName, urls, ecommerce = '', siteSearch = '', searchKeywordParameters = '', searchCategoryParameters = '', excludedIps = '', excludedQueryParameters = '', timezone = '', currency = '', group = '', startDate = '', excludedUserAgents = '', keepURLFragments = '0') [ No example available ]
- SitesManager.deleteSite (idSite) [ No example available ]
- SitesManager.addSiteAliasUrls (idSite, urls) [ No example available ]
- SitesManager.getIpsForRange (ipRange) [ No example available ]
- SitesManager.setGlobalExcludedIps (excludedIps) [ No example available ]
- SitesManager.setGlobalSearchParameters (searchKeywordParameters, searchCategoryParameters) [ No example available ]
- SitesManager.setGlobalExcludedUserAgents (excludedUserAgents) [ No example available ]
-
SitesManager.isSiteSpecificUserAgentExcludeEnabled ()
[ Example in
XML,
Json,
Tsv (Excel)
]
- SitesManager.setSiteSpecificUserAgentExcludeEnabled (enabled) [ No example available ]
- SitesManager.setKeepURLFragmentsGlobal (enabled) [ No example available ]
- SitesManager.setGlobalExcludedQueryParameters (excludedQueryParameters) [ No example available ]
- SitesManager.setDefaultCurrency (defaultCurrency) [ No example available ]
- SitesManager.setDefaultTimezone (defaultTimezone) [ No example available ]
- SitesManager.updateSite (idSite, siteName, urls = '', ecommerce = '', siteSearch = '', searchKeywordParameters = '', searchCategoryParameters = '', excludedIps = '', excludedQueryParameters = '', timezone = '', currency = '', group = '', startDate = '', excludedUserAgents = '', keepURLFragments = '') [ No example available ]
- SitesManager.getPatternMatchSites (pattern) [ No example available ]
Module Transitions
- Transitions.getTransitionsForPageTitle (pageTitle, idSite, period, date, segment = '', limitBeforeGrouping = '') [ No example available ]
- Transitions.getTransitionsForPageUrl (pageUrl, idSite, period, date, segment = '', limitBeforeGrouping = '') [ No example available ]
- Transitions.getTransitionsForAction (actionName, actionType, idSite, period, date, segment = '', limitBeforeGrouping = '', parts = 'all', returnNormalizedUrls = '') [ No example available ]
Module UserCountry
The UserCountry API lets you access reports about your visitors' Countries and Continents.
-
UserCountry.getCountry (idSite, period, date, segment = '')
[ Example in
XML,
Json,
Tsv (Excel)
, RSS of the last 10 days
]
-
UserCountry.getContinent (idSite, period, date, segment = '')
[ Example in
XML,
Json,
Tsv (Excel)
, RSS of the last 10 days
]
-
UserCountry.getNumberOfDistinctCountries (idSite, period, date, segment = '')
[ Example in
XML,
Json,
Tsv (Excel)
, RSS of the last 10 days
]
Module UserSettings
The UserSettings API lets you access reports about your Visitors technical settings: browsers, browser types (rendering engine), operating systems, plugins supported in their browser, Screen resolution and Screen types (normal, widescreen, dual screen or mobile).
-
UserSettings.getResolution (idSite, period, date, segment = '')
[ Example in
XML,
Json,
Tsv (Excel)
, RSS of the last 10 days
]
-
UserSettings.getConfiguration (idSite, period, date, segment = '')
[ Example in
XML,
Json,
Tsv (Excel)
, RSS of the last 10 days
]
-
UserSettings.getOS (idSite, period, date, segment = '', addShortLabel = '1')
[ Example in
XML,
Json,
Tsv (Excel)
, RSS of the last 10 days
]
-
UserSettings.getOSFamily (idSite, period, date, segment = '')
[ Example in
XML,
Json,
Tsv (Excel)
, RSS of the last 10 days
]
-
UserSettings.getMobileVsDesktop (idSite, period, date, segment = '')
[ Example in
XML,
Json,
Tsv (Excel)
, RSS of the last 10 days
]
-
UserSettings.getBrowserVersion (idSite, period, date, segment = '')
[ Example in
XML,
Json,
Tsv (Excel)
, RSS of the last 10 days
]
-
UserSettings.getBrowser (idSite, period, date, segment = '')
[ Example in
XML,
Json,
Tsv (Excel)
, RSS of the last 10 days
]
-
UserSettings.getBrowserType (idSite, period, date, segment = '')
[ Example in
XML,
Json,
Tsv (Excel)
, RSS of the last 10 days
]
-
UserSettings.getWideScreen (idSite, period, date, segment = '')
[ Example in
XML,
Json,
Tsv (Excel)
, RSS of the last 10 days
]
-
UserSettings.getPlugin (idSite, period, date, segment = '')
[ Example in
XML,
Json,
Tsv (Excel)
, RSS of the last 10 days
]
-
UserSettings.getLanguage (idSite, period, date, segment = '')
[ Example in
XML,
Json,
Tsv (Excel)
, RSS of the last 10 days
]
Module UsersManager
The UsersManager API lets you Manage Users and their permissions to access specific websites. You can create users via "addUser", update existing users via "updateUser" and delete users via "deleteUser". There are many ways to list users based on their login "getUser" and "getUsers", their email "getUserByEmail", or which users have permission (view or admin) to access the specified websites "getUsersWithSiteAccess". Existing Permissions are listed given a login via "getSitesAccessFromUser", or a website ID via "getUsersAccessFromSite", or you can list all users and websites for a given permission via "getUsersSitesFromAccess". Permissions are set and updated via the method "setUserAccess". See also the documentation about
Managing Users in Piwik.
- UsersManager.setUserPreference (userLogin, preferenceName, preferenceValue) [ No example available ]
- UsersManager.getUserPreference (userLogin, preferenceName) [ No example available ]
-
UsersManager.getUsersWithSiteAccess (idSite, access)
[ Example in
XML,
Json,
Tsv (Excel)
]
- UsersManager.getUserByEmail (userEmail) [ No example available ]
- UsersManager.addUser (userLogin, password, email, alias = '') [ No example available ]
- UsersManager.updateUser (userLogin, password = '', email = '', alias = '') [ No example available ]
- UsersManager.deleteUser (userLogin) [ No example available ]
- UsersManager.userEmailExists (userEmail) [ No example available ]
- UsersManager.setUserAccess (userLogin, access, idSites) [ No example available ]
- UsersManager.getTokenAuth (userLogin, md5Password) [ No example available ]
Module VisitFrequency
VisitFrequency API lets you access a list of metrics related to Returning Visitors.
-
VisitFrequency.get (idSite, period, date, segment = '', columns = '')
[ Example in
XML,
Json,
Tsv (Excel)
, RSS of the last 10 days
]
Module VisitTime
VisitTime API lets you access reports by Hour (Server time), and by Hour Local Time of your visitors.
-
VisitTime.getVisitInformationPerLocalTime (idSite, period, date, segment = '')
[ Example in
XML,
Json,
Tsv (Excel)
, RSS of the last 10 days
]
-
VisitTime.getVisitInformationPerServerTime (idSite, period, date, segment = '', hideFutureHoursWhenToday = '')
[ Example in
XML,
Json,
Tsv (Excel)
, RSS of the last 10 days
]
-
VisitTime.getByDayOfWeek (idSite, period, date, segment = '')
[ Example in
XML,
Json,
Tsv (Excel)
, RSS of the last 10 days
]
Module VisitorInterest
VisitorInterest API lets you access two Visitor Engagement reports: number of visits per number of pages, and number of visits per visit duration.
-
VisitorInterest.getNumberOfVisitsPerVisitDuration (idSite, period, date, segment = '')
[ Example in
XML,
Json,
Tsv (Excel)
, RSS of the last 10 days
]
-
VisitorInterest.getNumberOfVisitsPerPage (idSite, period, date, segment = '')
[ Example in
XML,
Json,
Tsv (Excel)
, RSS of the last 10 days
]
-
VisitorInterest.getNumberOfVisitsByDaysSinceLast (idSite, period, date, segment = '')
[ Example in
XML,
Json,
Tsv (Excel)
, RSS of the last 10 days
]
-
VisitorInterest.getNumberOfVisitsByVisitCount (idSite, period, date, segment = '')
[ Example in
XML,
Json,
Tsv (Excel)
, RSS of the last 10 days
]
Module VisitsSummary
VisitsSummary API lets you access the core web analytics metrics (visits, unique visitors, count of actions (page views & downloads & clicks on outlinks), time on site, bounces and converted visits.
-
VisitsSummary.get (idSite, period, date, segment = '', columns = '')
[ Example in
XML,
Json,
Tsv (Excel)
, RSS of the last 10 days
]
-
VisitsSummary.getVisits (idSite, period, date, segment = '')
[ Example in
XML,
Json,
Tsv (Excel)
, RSS of the last 10 days
]
-
VisitsSummary.getUniqueVisitors (idSite, period, date, segment = '')
[ Example in
XML,
Json,
Tsv (Excel)
, RSS of the last 10 days
]
-
VisitsSummary.getActions (idSite, period, date, segment = '')
[ Example in
XML,
Json,
Tsv (Excel)
, RSS of the last 10 days
]
-
VisitsSummary.getMaxActions (idSite, period, date, segment = '')
[ Example in
XML,
Json,
Tsv (Excel)
, RSS of the last 10 days
]
-
VisitsSummary.getBounceCount (idSite, period, date, segment = '')
[ Example in
XML,
Json,
Tsv (Excel)
, RSS of the last 10 days
]
-
VisitsSummary.getVisitsConverted (idSite, period, date, segment = '')
[ Example in
XML,
Json,
Tsv (Excel)
, RSS of the last 10 days
]
-
VisitsSummary.getSumVisitsLength (idSite, period, date, segment = '')
[ Example in
XML,
Json,
Tsv (Excel)
, RSS of the last 10 days
]
-
VisitsSummary.getSumVisitsLengthPretty (idSite, period, date, segment = '')
[ Example in
XML,
Json,
Tsv (Excel)
, RSS of the last 10 days
]
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.