Piwik PRO cookieless tracking


I have integrated a third party cookie consent tool with Piwik PRO by following these (1) and (2).

All of my tags have triggers tied with a cookie dataLayer variable i.e. the tags will only fire when visitors give their consent.

Now I’m interested in tracking some conversion events while no cookies are set for users who have not given consent. I have followed Piwik’s instructions here (3) and have ‘Collect data without using cookies’ enabled. In the tags, ‘Respect visitor privacy’ is also toggled off. However, it doesn’t work now as no data has been collected when visitors opt-out (as a note I don’t have any conditions in the trigger that requires Piwik to set a cookie).

Could you please give me some ideas how to fix this issue? I’m also curious how can we tell which data collected with/without consent, because I want to process only the raw data collected with consent.

Any suggestions are highly appreciated!


What is your current trigger for the Piwik PRO tag?

As for segmenting the data, given that you have already variables storing the information about consent, you could add a custom dimension that would store the information about consents.


This is the current trigger for the Piwik PRO tag:

So, this tag won’t run when there’s no consent.

The architecture of solution would have to be a bit different when you want to track users anonymously prior to the consent. My recommendation would be to fire the default Piwik PRO tag on each page view + configuration of additional logic to switch to the non-anonymous mode after consent. E.g. you could play with the value of this setting:

_paq.push(['setUserIsAnonymous', 1]);

Hi Kuba,

Thanks for your suggestion. So I guess other tags in my setup won’t fire either if I include cookie consent condition in the triggers and visitors don’t accept cookie? Could you please direct me to some documentations where I can read more about how to set up the cookieless tracking from a technical point of view? Thank you so much!

The guide you linked is quite accurate.

The default Piwik PRO tag includes the logic responsible for the anonymization and should be triggered on each page view. Then it’s just a matter of setting the consent via API (setInitialComplianceSettings method) when the consent is given (I guess you have the right triggers in place already for that).

To sum up, those are the steps:

  1. Track all data in anonymous mode
  2. Disable the default custom form
  3. Implement the logic informing Piwik PRO about a valid consent

PS. if you want to enrich the visit right after the consent was given (without waiting for the next page view), you can use _paq.push(['deanonymizeUser']); :slight_smile: