Im trying to disable any tracking whatsoever when user do NOT consent while having custom consent system. I need to have full control of tracking, full - meaning no tracking at all even anonymous data, pings etc. when user did NOT consent. I also want to have option to change decision any time!
Im having SPA application.
Sending events manualy (want to have full control).
My configuration:
In general GoogleAnalytics or Matomo have this easy to control simple flag which you set and all tracking is disabled. Im looking for something like that with no success.
Matomo way: _paq.push(['rememberConsentGiven', ...]);
/ _paq.push(['forgetConsentGiven', ...]);
GoogleAnalytics way: window[
ga-disable-${trackingId}] = false;
So I followed some custom consent form guidelines and read dev documentation.
Implemented how it should be according to docs as I understood it.
Setting at start: ppms.cm.api('setInitialComplianceSettings', { consents: ['analytics']});
Then when user makes action to accept / decline consents OR user already did it before (flag from BE response): ppms.cm.api('setComplianceSettings', { consents: { analytics: { status: consentValue ? 1 : 0 } } });
I even check if its set in cookies / storage and calling ‘getComplianceSettings’ command, every source shows its changed properly.
Everything is working properly at start.
Case accepted: ppms.js script is downloaded and some events are send in network and are visible on Tracker debugger.
Case declined: ppms.js script is NOT downloaded and no events are send in any way.
But when user changes mind and goes to change what was chosen before, then it seems like its not working as it should.
Case accepted → declined: pings are sent anyway unless you change “Count session time precisly” (would be nice to have those pings when accepted but not when declined), all manually triggered commands like trackPageView still sending events to Piwik system (can see them on Tracker debugger and browser’s network), I could make manual condition to not send any events if internal consent flag is false, but how can I be sure if something else would be send automatically which I didnt configured or there are some bugs or other unpredictable things (risk of breaking laws)
Case declined → accepted: ppms.js script is downloaded, and seems like everything works as it should
Case accepted → declined → accepted: same as above but getting error
ppms.js conflict
ppms.js:12 Matomo javascript tracker or Piwik PRO javascript tracker was already initiated on this page. Please check the tracker setup. Matomo conflict can be resolved using these instructions: https://help.piwik.pro/support/questions/can-i-use-piwik-pro-and-matomo-at-the-same-time/.
I do not use Matomo, its happening everytime I use command “setComplianceSettings”, with “accepted” payload (ppms.js script is downloaded again).
Seems like “setComplianceSettings” might be one use command (you only set it once and should not do it twice). So how can I change consent to false anytime with custom consent form? I saw opt-out form, but not custom one, so I assumed my custom form is enough, and I just have to use “setComplianceSettings” again (did not see any info about this command to be invoked only once per application life).
To summarize:
- How to properly change consent if its been already set before with CUSTOM consent form (both ways)?
- If using “setComplianceSettings” command multiple times with different payload is proper way, then what about this conflict ppms.js error?
- How to have “Count session time precisly” turned on when user consent but not having pings when user did not consent? manual heartbeat? (unless Im doing it wrong and it should be blocked when consent is declined after agreeing to it)
- Is there disable flag like GA or Matomo has?