Matomo (Piwik) is an analytics platform that collects data (Tracking API) and reports (Analytics API) this data in interesting formats. Sometimes you want to query this data from across other domains for example using cross-domain Ajax calls (XMLHttpRequest).

By default browsers implement the same-origin policy which prevents browsers from directly requesting data from other domains. Luckily, modern web browsers allow developers to perform cross-domain requests with one trick: the server must allow cross-domain requests by responding to the request with the Access-Control-Allow-Origin header set to a value that includes the domain of the requesting code (or * to match all domains).

To enable your Matomo (Piwik) server to serve data, edit your config/config.ini.php file. To allow your Matomo to serve data to all domains:

cors_domains[] = *

To allow Matomo (Piwik) to serve cross-domain requests to only and

cors_domains[] = ""
cors_domains[] = ""

Reference: Cross-origin resource sharing.

Any questions?

Many answers and more information about Matomo you can find here:

We are social

Follow us: