OneTrust + Piwik PRO Tag Manager + Piwik PRO Analytics


The setup:

  • Analytics platform: Piwik PRO Analytics
  • TMS: Piwik PRO Tag Manager
  • CMP: OneTrust
  • CMS: Drupal
  • Multiple domains and subdomains
  • Needs to be GDPR and CCPA compliant

The main challenge currently is to combine the use of OneTrust with Piwik PRO Analytics.

The questions:

  1. What is the best guide for implementing this combination? Is it this?: How can I integrate a third-party cookie consent tool with Piwik PRO? | Piwik PRO help center
  2. Is there going to be updates made to the guide mentioned above somewhere in the near future?
  3. The guide could be expanded. What is missing so far is the part where it guides the process in the third party CMP side, for instance in OneTrust. Would anybody happen to have a guide on how to implement OneTrust with Piwik PRO Analytics step by step with also the part on what are the best practices used in OneTrust?
  4. Any recommendations on how to do all of it with the current setup? (Shared consent on different domains, GDPR vs. CCPA etc.)
1 Like

Hi. The linked guide is the best one. We plan to further extend it with code examples for most popular CMPs, but there’s no ETA yet for that.

Consents currently can be shared only between subdomains. I guess it could be also shared between different domains, but for that you would need to:

  • add some custom js code to pass the decisions using link decoration
  • use our CMP api to apply the consents

Hi there. Thank you for your answers so far.

Could anybody expand the guide please. Mainly the 10th step: “Call the setInitialComplianceSettings() method and setComplianceSettings() method after a visitor agrees to analytics on your third-party consent form. This will make the visitor non-anonymous.

  1. Where should the methods be called? In the HTLM document itself, where in it? In the header before and/or after the OneTrust tag?
  2. Why there are empty functions in the example? Are these placeholders and for what?:
{ consents: { analytics: { status: 1 } } },
function () {}, <— this here
function () {} <— and this

Thank you.

  1. I’d check onetrust’s docs for code samples signalizing that the consent has just been given.
  2. All the arguments are described in the docs here.


  1. I have copied the code from the example and then I pasted it as it is into the header section of my page right after OneTrusts header tag. This in itself did not seem to cut it yet. So far it seems that Piwik has to be classified and categorised as a performance/analytics tool within OneTrust. After that Piwik will obey OneTrusts consent updates accordingly. Though unfortunately this does not seem to suffice exactly, because by using the methods described in this guide (Check if your tracking works correctly | Piwik PRO help center) mainly the Console inspection one, there seems to be no pre-consent tracking in place with this set up and the. Testing with _paq and _paq.push(['trackPageView']); pre consent console returns errors. Only after the consent, it returns something, though the response to _paq is not quite the same as in the example.

    Another way to inspect and validate the inner workings could be to use the Tracker Debugger. You describe the feature/tool in here: About tracker debugger | Piwik PRO help center. Unfortunately it seems to be missing from my account. I have the free Core plan, is the feature simply not included in my current plan?

  2. Unfortunately I am struggling to find an answer from the JavaScript API documentation. The arguments are described yes, but to me the documentation does not seem to provide an explanation for the empty functions and I was wondering if there were other ways to solve this?

  1. What is your current configuration of consent done via UI? I mean this screen:

  1. Here you have working examples on how to use the APIs: Piwik PRO - Custom consent form example | Custom consent form example for Piwik PRO Consent Manager


  1. so mine is similar to your image, here:

    Should there be different settings applied here to get the tracked debugger visible/available?

  2. Thank you for the link, I will try again and look for an answer in these API use examples.

The tracker debugger isn’t visible most likely because of CNIL compliance which is enabled in site’s settings.

Maybe Onetrust is blocking execution of Piwik PRO tag prior to the consent?