Can I use Piwik PRO and Matomo at the same time?

Yes, you can use Piwik PRO and Matomo at the same time. But, you need to make some adjustments to track all data correctly.

Piwik PRO uses the _paq.push() command to send data, and Matomo uses the same command. It’s because both tools originate from the same open-source product. In Piwik PRO, we’re working on changing the  _paq.push() to _ppas.push() command, so that it doesn’t interfere with Matomo. But before we do that, you need to use a manual setup.

There are two ways to set it up: modify the Piwik PRO’s tracking code, or modify Matomo’s tracking code.

Option #1: Modify the Piwik PRO’s tracking code

To modify the Piwik PRO’s tracking code, follow these steps:

  1. Log in to Piwik PRO.
  2. Go to Menu > Tag Manager.
  3. Navigate to Tags.
  4. Name the tag and select the following type: Custom code (async) (custom asynchronous tag).
  5. In Tag code, add this code.
    <!-- Piwik PRO -->
    <script type="text/javascript">
      var _ppas = _ppas || [];
      _ppas.push(['setUserIsAnonymous', 1]);
      _ppas.push(["trackPageView"]);
      _ppas.push(["enableLinkTracking"]);
      (function() {
        var u="https://example.piwik.pro/";
        _ppas.push(["setTrackerUrl", u+"ppms.php"]);
        _ppas.push(["setSiteId", "XXX-XXX-XXX-XXX-XXX"]);
        var d=document, g=d.createElement("script"), s=d.getElementsByTagName("script")[0];
        g.type="text/javascript"; g.async=true; g.defer=true; g.src=u+"ppas.js"; s.parentNode.insertBefore(g,s);
      })();
    </script>

    In this code, change the following elements:

    • https://example.piwik.pro/: The address you use to log in to Piwik PRO.
    • XXX-XXX-XXX-XXX-XXX: The ID of the site or app in Piwik PRO where you want to send data. (Where to find it?)
  6. In Advanced tag settings, choose Consent type: No consent is required.
  7. In Tag triggers, add the following trigger: All page views.
  8. Click Save.
  9. Go to Tags.
  10. Click Add a tag again. This time you’ll need to add a tag responsible for deanonymization when the user gives consent.
  11. Name the tag and select the following type: Custom code (async) (custom asynchronous tag).
  12. In Tag code, add this code:
    <script>
      _ppas.push([‘deanonymizeUser’]);
    </script>
  13. In Advanced tag settings, choose Consent type: Analytics.
  14. In Tag triggers, add the following trigger: All page views.
  15. Click Save.
  16. Test your tag in debug mode.
  17. Deactivate the following tag: Piwik PRO (tracking code). This code is responsible for collecting data, but you’ll use a modified version.
  18. Click Publish.

How to use custom events and goals

The paq.push() command is also used in custom events and goals. So you’ll have to use the manual setup to set them up.

To add a custom event, follow these steps:

  1. Add this script as a custom code in Tag Manager. Don’t use the custom event tag.
    <script>
    _ppas.push(["trackEvent", "category", "action"]);
    </script>

To add a goal, follow these steps:

  1. Add this script as a custom code in Tag Manager. Don’t use the goal conversion tag.
    <script>
    _ppas.push(["trackGoal", goal-ID, ConversionValue]);
    </script>

Option #2: Modify the Matomo’s tracking code

To modify the Matomo’s tracking code, follow these steps:

  1. Find the Matomo’s tracking code in your Matomo account. (Where to find it?)

    Example:

    <!-- Matomo -->
    <script type="text/javascript">
      var _paq = window._paq = window._paq || [];
      _paq.push(['trackPageView']);
      _paq.push(['enableLinkTracking']);
      (function() {
        var u="//{$MATOMO_URL}/";
        _paq.push(['setTrackerUrl', u+'matomo.php']);
        _paq.push(['setSiteId', {$IDSITE}]);
        var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
        g.type='text/javascript'; g.async=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s);
      })();
    </script>
    <!-- End Matomo Code -->
  2. Add this piece of code to the Matomo’s tracking code right after ‘setSiteID’:
    _paq.push(['addTracker', dataCollectionURL, siteIDinPiwikPRO]);

    In this code, change the following elements:

    • dataCollectionURL: Your Piwik PRO account URL, followed by ‘ppms.php’. Example: https://example.piwik.pro/ppms.php
    • siteIDinPiwikPRO: The ID of the site or app in Piwik PRO where you want to send data. (Where to find it?)
  3. Done! Now all of your events sent to Matomo will also be sent to Piwik PRO. Data will appear in reports in about an hour. Data in the tracker debugger will appear instantly.

    Note: This method works for now because we are backwards compatible with Matomo. You can track a site with Matomo’s tracking code and send it to Piwik PRO. But as both products grow, there will appear some differences and this method might stop working.

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