How can I customize sampling for page timing reports?

Analytics

By default, 10% of all tracked events store information about the page performance. It is possible to customize it by adding a custom tag in the Tag Manager.

To increase the sample to 15% for example, follow these steps:

  1. Open Piwik PRO.
  2. Navigate to Menu > Tag Manager.
  3. Click + Create new tag.
  4. Name the tag.
  5. Select Custom code (async) tag (custom asynchronous tag) and click Save.
  6. Paste the following code:
    <script>
        var _paq = _paq || [];
        _paq.push(['setTimingDataSamplingOnPageLoad', 15]);
    </script>

    Note: In this code, you can change the number 15 to a different number to have a smaller or bigger sample. If you use 15 it means that 15% of the all tracked events will be measured to track the performance of pages.

  7. Click + Existing trigger.
  8. Pick the All page views trigger.
  9. Click Save.
  10. Click Publish

If you increase the sample to a much greater value than 15%, it will increase the number of tracking requests significantly and may cause performance problems in the tracking.

Was this article helpful?

Technical support

If you still have some questions, visit our community.
There’s always someone ready to help!

Back to help center