Are Piwik reports in real time?

By default, Piwik reports are in real time (learn more in the user documentation) when you are viewing reports for “today” or any date range that includes today. Piwik will look at all your logs for today in the database and process the reports every time that you request them.
By default, reports for today are processed every 10 seconds. The Piwik Super User can change this value in the “General Settings” admin panel. For high traffic websites, we recommend processing the reports once every hour (3600 seconds), which is a “near real time” approach.
Please read the Setup auto archiving page for more information.
Piwik also provides a real time view of your visits on your site… right now! You can see all new page views, actions and new visits coming to your site, refreshing automatically. This feature is enabled by the Live! plugin which is enabled by default in the Piwik dashboard (check out the demo).

Does Piwik support clickpath or clickstream analytics?


Clickstreams or clickpaths represent the sequences of actions performed (clicks, etc.) and webpages visited by a website user.

This includes detailed information found under the Visitor > Visitor log menu in the Piwik dashboard, and can be complemented with Page overlay and Transitions graphical visualizations.

How is a ‘unique visitor’ counted in Piwik?

The number of unduplicated visitors coming to your website. Every user is only counted once, even if he visits the website multiple times a day.

Unique visitors are determined using first party cookies stored in your visitor browser. When a same person visits your website on two different devices (for example their laptop and on their mobile phone) then Piwik will detect two unique visitors.

If the visitor’s browser does not accept the Piwik cookie (if they have disabled, blocked or deleted cookies), a simple rule of thumb is used to try to match the visitor to a previous visitor with the same features (IP, resolution, browser, plugins, OS, etc).

Note that by default, unique visitors are available for days, weeks and months periods, but unique visits are not processed for the “year” period for performance reasons. Learn how to enable unique visitors for all date ranges.

See also our glossary of analytics terms.

How is a ‘visit’ defined in Piwik?

If a visitor comes to your website for the first time, or if he visits a page (or downloads a file) more than 30 minutes after his last page view, this will be recorded as a new visit. A Unique Visitor can make multiple Visits per day.
In the first visit, the visitor is a New Visitor. From the second visit (the same day or later), a Unique Visitor is a Returning Visitor.
You can change the 30 minutes value (session timeout) by overriding

visit_standard_length = 1800

in your config/config.ini.php file.

See also our glossary of analytics terms.

What is an ‘Entry page’?

Entry page is the first page of a visit.

For each Entry Page URL, Piwik reports the number of Entrances (Visits that started on this page), Bounces (Visits that started on this page but left the website straight away) and Bounce rate.

See also our glossary of analytics terms.

What is an ‘Exit Page’?

The Exit Page is the last page accessed during a visit.

Piwik reports the top Exit Pages URLs, the number of Exits, Unique Pageviews and Exit Rate. Exit rate (sometimes called “Page Exit Ratio”) is the number of Exits from a page divided by total number of Page views of that page.

See also our glossary of analytics terms.

What is the ‘super user’ in Piwik?

Super Users are the only users that can perform all administrative tasks such as adding new websites to monitor, adding users, changing user permissions, activating and deactivating plugins and even installing new plugins from the Marketplace.

By default in Piwik there is one super user which was created during the installation process. As of Piwik 2.1, you may give Super User permission to other users.

The Super User has superpower!

What is the ‘admin’ permission in Piwik?

You can create users and assign them the ‘admin’ permission on a given set of websites. Users with the ‘admin’ permission can edit the website settings (Name, URLs, Timezone, etc.). They can also grant other users the ‘view’ or ‘admin’ permission on the website(s) the user has ‘admin’ permission.

Users with ‘admin’ permission cannot add other websites and users, and they cannot manage plugins.

What is the ‘view’ permission in Piwik?

The Super User can create users and assign them the ‘view’ permission on a given set of websites. Users with the ‘view’ permission can view all reports in Piwik for the website(s) the user is set to ‘view’. The user cannot add other users, websites, and they cannot manage plugins.

What is the token_auth and where can I find this token to use in the API calls?

The token_auth acts as your password and is used to authenticate in API requests. You can find the token_auth by logging in Piwik, then click on your username in the top menu, then click the link “API” in the left menu.

The token_auth is secret and should be handled very carefully: do not share it with anyone. Each Piwik user has a different token_auth.

When a user changes its password, the token_auth will be regenerated automatically.

Can I install Piwik on one server and track visits on websites that are hosted on other servers?

You can track as many websites as you like that are hosted on the same server as Piwik, or hosted on several external servers. Only the server that hosts Piwik needs to run PHP and MySQL.

There is nothing special to do to track websites from different domains. You simply need to create new websites by going to the admin area when logged in as Super User, and then click ‘View the javascript tracking code’ (help) to install on the websites you wish to track. For example, consider the following use case:

  • You have a website built in Java hosted on server1
  • You have a website built in Python hosted on server2
  • You can install Piwik on server3, and track visits from the two other websites

Note about https: Piwik automatically detect if the page being tracked is https (SSL) and would include the piwik.js in secure mode from your Piwik server.

How do I find the website ID, also called idSite or Site ID?

Piwik lets you measure several websites within one Piwik server. Each website added into Piwik has its very own ID Site (or Website ID). To find out the idSite value for a given website, go to Piwik, then click on “Administration” link in the top menu and go to the Websites page. In this page you will find the list of all websites. The website ID is on the left of this table listing all websites (below the website name).

How long does the Piwik archiving process take for high traffic websites – or hundreds of websites?

Every night, if you setup auto-archiving, Piwik will run through the logs and compile all your reports for each day, week, month and year. How long the process will take depends on your traffic, number of visits and pages, on the number of websites you have setup in Piwik… and of course on your server performance.
For example, using version 1.3 on a single core duo2 server with 3GB of ram, Piwik archiving process takes about 2 hours for 400,000 pages per day (and more than 6,000 websites). We are constantly improving Piwik performance: making Piwik faster is a top priority. Stay tuned… or come and help us if you know how to design software to make it faster.

Also, if you have a medium or high traffic website, we would be interested to hear your experience with Piwik archiving. How long does archiving take for your traffic, how many visitors/pages, how many websites, what type of server; Please post your numbers in the High traffic Piwik servers forum post, and let us know by email.

For practical information about managing Piwik for high traffic websites, see this FAQ: Piwik web analytics for high traffic websites check list.

Is the Piwik Javascript Tracking Code XHTML 1.0 compatible?

Yes, Piwik Javascript Tracking code is valid XHTML 1.0 Strict. See an example on .

Why are there sometimes 0 visits, but some conversions recorded, for example for a Keyword, a Website or a Custom Variable?

Imagine the following use case:

1) User comes to your website via the campaign “Emailing November”, via a click on a link in an email tagged with Piwik (or Google Analytics) campaign parameters
2) He browses around and exits after 3 pages
3) He comes back the next day (on 2011-01-01), via a direct entry, and buys a product on your site (which you track as a Goal Conversion)

In this case, if you select the date 2011-01-01 in Piwik, it will show that the Campaign “Emailing November” did not have any visit on this day (because the user entered the website directly), but the conversion is attributed to the Last known referrer that the visitor used (which is stored in the first party cookie). On 2010-12-31, there will be one visit from the campaign “Emailing November” but no conversion on this day.

See also the FAQ: Piwik attributes conversions to the last seen referrer by default. How do I credit conversions to the first referrer instead?.

Piwik attributes conversions to the last seen referrer by default. How do I credit conversions to the first referrer instead?

When visitors convert a Goal, Piwik tries to attribute the conversion to the referrer that brought the visit to the site. Piwik will credit this Goal conversion to the last non empty referrer used by the visitor (ie. the last time the visitor came to the website with a referrer that was not a direct entry). In some cases several referrers can lead a same visitor to your website (eg. Search engines, Newsletter link). Piwik attribution model lets you choose whether to credit the conversion to the first referrer used or the last referrer used.

To attribute the Goal conversion to the first referrer used instead of the last one, edite your Piwik Javascript Tracking code and add the following line just before the call to trackPageView:

_paq.push(['setConversionAttributionFirstReferrer', true]);

A search engine is counted as a website referer. How can I add the search engine to Piwik?

To add a new search engine in your Piwik server, you can use the ReferrerManager plugin which lets you manage Search Engines and Social networks.

To submit a new search engine to Piwik (and have it included in the next release), please click here to open a Pull request.

Each search engine is defined by a new line with the following format:

"" => array( "Search engine name", "keyword parameter", [optional path containing the keyword], [optional charset used by the search engine])

For example, for Yahoo!

""      => array("Yahoo!", "p", "search?p={k}"),

The macro {k} will be automatically replaced by the keyword to link to the search engine page for the keywords found in your Piwik reports. The main search engine URL has to be at the top of the list for the given search Engine.
Note that some search engines can have several variable names to define the keyword, you can specify an array of names. For example, for the search engine, the keyword can be found in “wd”, “word”, or “kw”, and the keywords are encoded in the charset “gb2312”. The line for looks like:

""         => array("Baidu", array("wd","word","kw"), "s?wd={k}", "gb2312"),

(Piwik uses an icon for each search engine icon, placed in the directory plugins/Referers/images/)

What is “page title not defined” in the Page titles report?

Piwik provides two reports for your page views: Page Titles and Page URLs. A page title is the content of the HTML <title> tag. If your pages do not define this <title> Piwik will instead report “page title not defined” for the visits on those pages.

We also highly recommend you use the latest version of the Javascript Tracking Tag in case you are still using the old Tracking tag.

What is “page url not defined” in the Pages report?

Piwik provides two reports for your page views: Page Titles and Page URLs. In some rare cases, a visitor’s browser will not let the Piwik Tag request the current URL (generally for privacy reasons). If Piwik could not request the page URL from the browser, Piwik will instead report “page url not defined” for the visits on those pages.

If all your pages report “Page url not defined” then there is a data tracking problem. Here are common reasons for this issue:

  • 1) check that the Javascript code in your pages is correct,
  • 2) check that there is no automatic HTTP redirection on the piwik.js and piwik.php requests (for example via an .htaccess). 301 Redirection from http:// to https:// will not decode/encode properly some parameters especially URL parameters that look like a URL. The reason of this issue is still unknown but probably due to a bug in the webserver. Ensuring there is no redirection in your Piwik tracking calls will also ensure better performance. One way to ensure that there is no redirection from http to https is to modify your Piwik JavaScript tracking code and prepend https, here is an example: var u="https://your-piwik-server-url/";
  • 3) if you manually track file downloads using _paq.push(['trackLink', '', 'download']) for example, note that you must use a full valid URL.
  • 4) If your pages are correctly tracked but you still don’t see any URL being tracked, please investigate/debug the issue with Firebug or ask in the forums posting your site URL so we can help you.

In the Providers report, what does “Unknown” mean?

Piwik uses a special php function (gethostbyaddr) to request the hostname associated to a given IP. For example, the function would return “” and Piwik would categorize the visitor as using the provider “Comcast”. Sometimes however, for specific IPs or when the function times out, Piwik doesn’t know which provider the visitor is using and will simply report “Unknown”.

What does “Keyword not defined” mean in the Referers > Search Engines keywords report?

“Keyword not defined” means the search engine did not pass to your website the keyword used by your visitors — Search engines hide the keyword for privacy reasons. It is common that most keywords are “Not defined” after Google changes made in early 2012.

Some search engines (Google for all logged in users, DuckDuckGo, Firefox latest version now also removes keywords, etc.) may not specify the keyword used to reach your website. Piwik will report the keyword as “Keyword not defined”. It means that Piwik has detected that the visitor came from a search engine, but the keyword was not provided in the Referrer URL.
There is no way to access the keyword in this case, and no other web analytics tool can get this information either.

Can I help translate Piwik into my native language, or improve the existing translation?

Of course you can! We love having people help us make sure Piwik is available to as many people as possible in a language they understand. Please see Piwik Translations for more information.

Does the Piwik Tracking tag work on https (SSL) pages?

To track your https pages correctly, your server hosting Piwik should work when called from https. You will need to buy a SSL certificate for your Piwik server.

Many Piwik users successfully use Piwik to report analytics of Ecommerce and SSL secure shops.

The Piwik tag detects the protocol of the page being tracked, and then automatically calls the normal http or secure https Piwik server.

To check whether your Piwik server works over HTTPS, go to: https://url/to/piwik/piwik.php?rec=1&idsite=1 – if it returns a blank page it is working. If https://url/to/piwik/piwik.php?rec=1&idsite=1 returns an error, please contact your sysadmin to ask her to enable SSL on the Piwik server.

On a related note, you can also force the Piwik login form to use secure SSL connections.

To ensure that your visitors and all their actions on SSL HTTPS pages will be correctly tracked in your Piwik, you need to check that your SSL Piwik Server is correctly configured.

Does Piwik support IPv6 protocol?

Yes, Piwik works well with any IPv6 addresses. Here is further information:

  • Tracking API will track users with an IPv6 address.

  • Visitor Log and other detailed user reports will display IPv6 addresses.

  • IP Anonymisation privacy feature will anonymise IPv6 addresses.

  • Geolocating IPv6 does not work very well: most IPv6 will not be accurately geo located. A few Ipv6 addresses may be geo-located when using the PHP or Apache geo location driver. IPv6 geo location does not work with the Maxmind PECL driver (issue). Geo locating Ipv6 addresses may improve in the future as Maxmind (our Geo database provider) improves the accuracy of their IPv6 databases.

  • Logs containing IPv6 addresses can be imported in Piwik without any issue and they will be correctly parsed, anonymised (when applicable), stored and processed.

Here is an example of an Ipv6 address: 2001:0db8:85a3:0000:0000:8a2e:0370:7334.

Does Piwik support Google Analytics campaign parameters (utm_campaign, utm_medium, utm_source, utm_term)?

Piwik detects URLs tagged with Google Analytics campaign parameters. By default, Piwik offers two dimensions for Campaign tracking: name, and keyword. The parameters utm_campaign, or utm_medium, or utm_source are used as the Campaign name. The parameter utm_term is used as the Campaign keyword. You can learn more about Tracking Campaigns in Piwik or head over to the URL Builder.

If you need to track more than two campaign dimensions in Piwik, for example if you want to enjoy the same campaign reporting as in Google Analytics, you can install the AdvancedCampaignReporting plugin available here on the Marketplace. AdvancedCampaignReporting plugin lets you track up to five Campaigns parameters (name, source, medium, keyword, content).

Advanced users:
* you may choose to customise campaign parameters detected by Piwik.
* you can use campaign parameters in the query string landing?utm_campaign=PaidSearch, and Piwik also detects campaign and keyword in the hash tag string landing.html?q=test#utm_campaign=PaidSearch

What is a Product SKU in the Ecommerce Analytics report?

SKU stands for Stock-keeping unit. A Product SKU is a string representing the Product unique identifier in your Ecommerce shop: for example SKU for books might be the IBAN identifier for this book such as 8120725247. A given Product might change its name overtime, but the product’s SKU should always be the same. With Ecommerce Analytics, you can track Product SKUs, Product Names and Product categories and get interesting reports about their performance in our online shop.

When I enable “Purge old logs” in the Privacy settings, how do I make sure that no historical data is lost?

If you enable ‘Purge old visitors logs‘ in the Administration > Privacy menu, Piwik will regularly delete your Visitor Logs from the Database. The Logs are used by Piwik to process Reports such as “Top Keywords”, “Top pages”, etc. If some old logs are deleted from your database, but reports have not been yet processed, the data will be lost forever.
We highly recommend that before deleting old visitor logs from your database,

1) you setup the automatic archive processing,
2) and run the console core:archive console command until completion at least one time, making sure there are no errors during the execution.

This will ensure that all daily reports for each website have been pre-processed and the logs are no longer needed for these days.

What is the difference between Custom Dimensions and Custom Variables?

Custom Dimensions are similar to Custom Variables but they provide several advantages:

  • Each dimension has its own menu item under either “Visitors” or “Actions” making them first class citizen reports
  • A single Custom Dimension report can be widgetized whereas it is only possible to widgetize all Custom Variables reports combined
  • More metrics are available for Custom Dimensions in scope “Action” (Unique actions, Exit rate, Bounce rate, Average time on dimension, Average generation time) and the row actions Segmented Visitor Log, Overlay and Transitions can be used
  • Custom Dimensions are easier to segment as the segment name will be the name of your Custom Dimension in the UI
  • Custom Dimensions are more efficient as they need less storage and reports can be generated faster
  • Custom Dimensions are easier to track as no scope and no name needs to be set
  • Custom Dimension values in scope Action can be tracked automatically by extracting the value from the tracked URL or Page Title
  • The name of a Custom Dimension can be changed at any time
  • Values of Custom Dimensions are limited to 255 characters whereas Custom Variables are limited to 200

However, there is also a limitation. Unlike Custom Variables you cannot use the same slot/index for many different names or use cases. While for both Custom Variables and Custom Dimensions 5 slots in scope Action and 5 slots in scope Visit are available, you cannot use a specific slot of a Custom Dimension for something else. Once you have created a new Custom Dimension you can only deactivate it. Deleting a dimension and creating a new one is not possible. However, if you ever run out of available Custom Dimension slots you can make more available at any time. This just might take a while as it requires schema changes in the database.

In general we recommend users to use Custom Dimensions as we will deprecate Custom Variables at some point. With Piwik 3.0 Custom Dimensions will be most likely installed by default.

How many Custom Variables can I set to visitors and/or page views?

Piwik custom variables tracking provides a powerful & easy way to track custom values and variables about your visits (for example “Username”, “Membership level”) or page views (eg. “Category:Sport”). You can track up to 5 variables for each Visit on your website. On top of these 5 custom variables for each visit you can also track up to 5 custom variables for each page view.

Learn more about Custom Variables Analytics.

How can I become an official Piwik Consultant?

We are always looking for more quality developers to join the Piwik fun! If you want to be listed on the Piwik Consulting page, you need to know about Piwik internals: please have a look at the developer documentation, the code and the coding standards that we use to review submitted code.

To be an official Piwik Consultant, you need to either:

We will then review your work and consider adding you in the official Piwik Consulting listing.

For inspiration, please have a look at the Piwik roadmap ; the list contains lots of interesting problems to solve, in different fields: performance and scaling, User Interface, Web analytics reports, core mechanisms, Plugins related tasks, etc.

If you need more information or if you want to become a Piwik consultant, please contact us at : we are looking forward to helping you!

Privacy policy: How do I update my privacy policy to explain Piwik Analytics?

When you use Piwik to track your visitors, we recommend to update your Privacy Policy to explain how Piwik is used and what data it gathers. We provide a Privacy Policy template for Piwik users that you can copy on your site.

Note: If you do not already have a Privacy Policy on your page, but gather some information about your users, we highly recommend that you create the privacy policy.

What are the cookies created by Piwik JavaScript Tracking client?

To track visitors, Piwik by default uses 1st party cookies, set on the domain of your website. Cookies created by Piwik start with: _pk_ref, _pk_cvar, _pk_id, _pk_ses.

When you exclude yourself from being tracked using the cookie method, Piwik will create a cookie piwik_ignore set on the domain of your Piwik server (which might be a third party cookie if Piwik is setup on a different URL from the website being tracked).

You can also Disable all first party cookies from being set — for example for privacy reasons.

Piwik by default does not use third party cookies but you can enable a third party _pk_uid cookie it if you wish.

Learn more about What data does Piwik track?.

How do I let visitors opt-out from tracking?

To respect the privacy of your visitors, it is recommended to include the Piwik Opt-out iframe in your website. This iframe will display to your users a short text and let them opt-out in one click.

To find the code for the iframe, login Piwik, then click Administration and then click Privacy.

Here is what the opt-out iframe looks like:

Learn more in the Privacy user guide.

How do I disable all cookies for a visitor?

In some countries, the law requests websites to provide a way for users to opt-out of all tracking, in particular tracking cookies.
Piwik uses cookies to store some information about visitors between visits. See also: List of cookies used by Piwik.
It is easy to disable tracking cookies by adding one line in the Piwik Javascript code. Edit your Piwik Javascript code as follows:

// Add this line before the trackPageView() call

When cookies are disabled by a visitor, how does it impact Piwik reports accuracy?

There are various cases where cookies can be disabled: browser has cookies disabled, Piwik JavaScript code disabled cookies via call to disableCookies(), or if you are importing server logs in Piwik which do not contain cookie information.

When cookies are disabled, some data in Piwik will be less accurate. Specifically…

  • Piwik uses cookies to store a unique visitor ID, used to recognize visitors from previous visits. When cookies are disabled, Piwik will still be able to determine unique visitors based on IP address and other footprints, but this will be slightly less accurate.
  • Ecommerce and Goal tracking attribution: By default, Piwik stores the website or keyword or campaign used to find the website in a cookie, so that we can credit this website when the visitor makes a conversion (Goal conversion or Ecommerce order). If the conversion happens in the same visit, Piwik will always credit the referrer (even if cookies are disabled). However imagine the following use case: the visitor uses a newsletter link tagged with a campaign, visits 5 pages on your website but does not buy. He then comes back 2 hours later directly typing your website URL (therefore a Direct Entry visit), then buys during this second visit. When cookies are enabled, Piwik credits the conversion to the initial Campaign. When cookies are disabled, the conversion is not attributed to the original newsletter link as this data is not available.
  • Reports such as “Days since last visit”, “Visits by visit count”, “Visits to Conversion”, “Days to Conversion” will count all visits without cookie similarly to new visitors.

See also: How does Piwik detect unique and returning visitors?

What data does Piwik track?

When you use the Piwik JavaScript Tracker Piwik will by default track the following information:

  • User IP address (see also: IP anonymisation)
  • Optional User ID
  • Date and time of the request
  • Title of the page being viewed (Page Title)
  • URL of the page being viewed (Page URL)
  • URL of the page that was viewed prior to the current page (Referrer URL)
  • Screen resolution being used
  • Time in local user’s timezone
  • Files that were clicked and downloaded (Download)
  • Links to an outside domain that were clicked (Outlink)
  • Pages generation time (the time it takes for webpages to be generated by the webserver and then downloaded by the user: Page speed)
  • Location of the user: country, region, city, approximate latitude and longitude (Geolocation)
  • Main Language of the browser being used (Accept-Language header)
  • User Agent of the browser being used (User-Agent header)

From the User-Agent, we use our Universal Device Detection library to detect the browser, operating system, device used (desktop, tablet, mobile, tv, cars, console, etc.), brand and model.

Some information is also stored in first party cookies and then collected by Piwik:

  • Random unique Visitor ID
  • Time of the first visit for this user
  • Time of the previous visit for this user
  • Number of visits for this user

(Note: it is possible to disable tracking cookies)

You may also configure Piwik to track optional information about your users or how they are using your website and apps:

How does Piwik detect unique and returning visitors? (with User ID, Visitor ID from cookie and/or fingerprint)

This FAQ explains how does Piwik Tracking API detect unique visitors, and returning visitors, depending on how the Tracking API is used.

When a visitor views a page or screen, Piwik will attempt to detect whether this request belongs to an existing visit, and/or whether the visitor has visited the website before.

How does Piwik detect whether the visitor is known?

  • If a User ID is set, either via setUserId in your favorite SDK or via &uid= in the Tracking API, this User ID will be converted (hashed) into a Visitor ID hexadecimal string. The hashed User ID becomes the Visitor ID. We look first for visits where the log_visit.idvisitor matches this Visitor ID (User ID). If no visit is matched, we look for visits where the log_visit.config_id matches the visitor fingerprint.
  • When a Visitor ID was manually set in the Tracking API via &cid= (see: Tracking API reference for cid), we only look for visits where log_visit.idvisitor matches this &cid.
  • When trust_visitors_cookies is set to 1 (see: FAQ about trust_visitor_cookies), and a visitor ID is found either in first party cookie _pk_id (see: first party tracking cookies) or in the third party cookie (see: enabling third party cookies), we only look for visits where log_visit.idvisitor matches the visitor ID from cookie.
  • Otherwise when a visitor ID is found in a first party cookie or in the third party cookie, we look first for visits where the log_visit.idvisitor matches the visitor ID from cookie. If no visit is matched, we look for visits where the log_visit.config_id matches the visitor fingerprint.
  • Finally, when there is no visitor ID found in first party cookie (nor in the third party cookie) and a visitor ID was not specified via &cid=, we only look for visits where the log_visit.config_id matches the visitor fingerprint.

In all cases, when “looking for visits” in the past, we look back window_look_back_for_visitor seconds. By default, Piwik will look back 30 minutes (default value for window_look_back_for_visitor INI setting). This setting can be changed: learn more.

If a visitor is found, then Piwik will assign the current request to this existing visitor, either by updating the current visitor’s visit or by creating a new visit when appropriate (learn more about what Piwik considers a visit)

How does Piwik detect a returning visitor?

A visitor will be marked as ‘Returning visitor’ when:

  • she has visited the website at least once before this visit (this can be detected via the ‘visit count’ and ‘first visit time’ and ‘last visit time’ found in tracking cookie and sent to Tracking API as &_idvc= and &_idts= and &_viewts=)
  • or she has visited the website but with tracking cookies deleted or lost, Piwik still managed to find a previous visit from this person (applicable when customising window_look_back_for_visitor learn more)
  • or she has purchased an item on the website before this visit (according to the ‘last ecommerce order date’ found in tracking cookie and sent to Tracking API as &_ects=)

Is the Piwik JavaScript Tracker CSP (Content Security Policy) compatible and how do I set it up?

Yes, Piwik 2.15.0 and newer can be used with CSP. However, you cannot use the standard tracking code generated by the Tracking Code Generator in the Piwik UI as it is not allowed to use inline scripts when having CSP enabled. CSP is a security concept to prevent cross-site scripting (XSS) attacks as well as related attacks.

Setting up the JavaScript Tracker

Instead make sure to put the tracking code into files like this:

<script src="" async defer></script>
<script src=""></script>

The file piwik.js should be loaded from your Piwik server and tracking.js should contain the actual tracking calls like this:

var idSite = 1;
var piwikTrackingApiUrl = '';

var _paq = _paq || [];  
_paq.push(['setTrackerUrl', piwikTrackingApiUrl]);
_paq.push(['setSiteId', idSite]);

Make sure to specify the correct idSite if needed and to replace the Piwik Tracking API URL. You can build this URL by appending /piwik.php to your Piwik domain.

Configuring Content-Security-Policy

If you load piwik.js from a different domain make sure to allow the Piwik domain like this: script-src 'self' If you load third party JavaScript files or if you have a CDN you might have to add even more domains to the whitelist.

An example response header looks like this:

Header set Content-Security-Policy "default-src 'self'; script-src 'self'; style-src 'self'; frame-ancestors 'self'; frame-src 'self';"

If CSP should work in all browsers you might have to add further headers. At the time of writing this article you might as well need to set X-WebKit-CSP for Safari and X-Content-Security-Policy for Internet Explorer support. Read more about Content Security Policy.

Which HTTP request headers are used by Piwik?

When measuring activity with the Piwik Tracking API, the following HTTP headers may be used:

  • Host – the hostname of the HTTP request, the hostname of the Piwik server.
  • Referer – used to track Referrer information such as website, search engine, social network.
  • User-Agent – used to detect the information about browsers, operating system, devices by device-detector library.
  • Cookie – when Opted-out from tracking, or when Third party cookies are used.
  • Origin – used when cross-origin resource sharing is enabled.
  • Accept-Language – used to detect the users’ language
  • X-Forwarded-Proto, X-Forwarded-Host, X-Forwarded-For – when Piwik is setup behind a proxy
  • DNT – used to detect whether a visitor’s device is opted-out from tracking (Piwik privacy)

When the Piwik server is unavailable (down) how does this affect my websites loading speed and tracking data collection?

It may happen that your Piwik analytics platform service is down / unavailable temporarily. Here are some important notes:

  • Your websites will still load correctly and should not be affected by any problem on the Piwik side. In the worst case scenario where Piwik server(s) are completely down and do not serve the /piwik.js file, users’ browser will still render your websites quickly because Piwik uses an asynchronous JavaScript library to measure users. The asynchronous JavaScript means that Piwik piwik.js file is optional for your website to render.

  • If for a few minutes or a few hours, your Piwik service is down, you may have lost data for this time period. In some cases, it is possible to replay most, or all, of the lost data. Learn more about how to replay your Piwik web server access logs and restore your tracking data that was not imported during the outage.

Piwik and phpMyVisites

Piwik is the successor to phpMyVisites, founded by Matthieu. There will be no future development, bug fixing or new releases of the phpmyvisites project.

The phpMyVisites website, documentation, downloads will always stay live but we strongly encourage users to start using Piwik as soon as possible (check out the online demo or the list of Analytics features).

What other free/libre software projects does the Piwik team create and maintain?

At Piwik we are fond of libre and free and open software! Besides the Piwik platform, we have created and maintain other open source projects:

Our free projects related to Piwik

  • Device Detector: the Universal Device Detection library will parse any User Agent and detect the browser, operating system, device used (desktop, tablet, mobile, tv, cars, console, etc.), brand and model.
  • Mobile SDKs: we created and maintain the iOS SDK for Piwik and the Android SDK for Piwik to let you measure your mobile applications.
  • Tracking API Clients: our core team and community create and maintain Tracking API SDKs in multiple languages: Java, C#, PHP, JavaScript, Python. (we are looking for new creators of SDK for Piwik, ideal if you love open source, Piwik and either Ruby or Node.js or C++ or Go or any other awesome programming language or platform!)
  • Piwik Mobile app: our mobile app running on Android and iOS devices is free/libre software project.
  • Several Plugins for Piwik: all plugins are published on our open Marketplace.

Reusable PHP components

  • Cache component is a PHP caching library based on Doctrine cache.
  • Decompress component is a PHP library that provides several adapters to decompress files.
  • Network component is a PHP library that provides network tools in particular manipulating and anonymising IP addresses.
  • INI component is a PHP library to read and write INI configuration files.

Other Open source projects

  • CI Status is our dashboard for continuous integration. If you use Github and Travis CI, you can test it at:
  • CI Trigger is a tool for Travis CI that lets you restart your builds automatically on a schedule.
  • Github Changelog Generator: a handy tool that queries the GitHub issues API to create and format a changelog based off the closed Github issues.
  • Github Issues Mirror: we created this tool to let any Github issues users create a read-only mirror of all issues. This has several advantages: Data ownership, Better for SEO in case not all of your GitHub issues are indexed by Google, in case GitHub is down you can still access your issues. Our Issues mirror is here:
  • Github Sync: a tool to let you synchronize labels and milestones accross several GitHub repositories. We use this to synchronise our issues labels and milestones across 50+ repositories.

Any questions?

Many answers and more information about Piwik You can find here:

We are social

Follow us: