Where do I find the javascript-code for matomo opt-in? I need to use it in the wp-plugin cookie notice. There is a field, where I have to fill code in.
The plugin “cookie notive” offers a field to put some code into it. It sets the code in the head and has the function to block script. it says:
To get the user consent status use the cn_cookies_accepted()
function.
If I am using the code you showed me with your link nothing is happening. I cannot find an explanation what this can be: cn_cookies_accepted()
function
I am pleased, if you could help. Thank you.
The basic tracking code has to be implemented with the Method _paq.push(['requireConsent']);
(before calling trackPageView). That tells Matomo to not issue tracking requests until the consent was given.
As soon as the user has confirmed consent for Matomo / in general, you can call _paq.push(['rememberConsentGiven']);
to tell the tracker that it is now allowed to track the user.