Matomo, WordPress and GDPR


I ran into a problem while implementing the GDPR.

I want to place the code to ask for consent of the visitor, but when copieng the code and placing it in the tracking code of the the Matomo Plugin, the text appears above the website like when debugging is on. Instead I want to have the field below the website where cookies are as well

any suggestions?


(Lukas Winkler) #2


Sorry, but I don’t quite understand your issue. What code are you copying, what text does appear and where exactly do you want to have a field?


Hello Lukas,
here is a more detailed description:

  1. I open “Ask for Consent” in Matomo.
  2. now I copy the Code from Step 1"// require user consent before processing data
  3. than I open my website and open the page of the matomo plugin
  4. change the code to manual entry5. place the code from 2 above the word Matomo

Now I would like the box to appear as in the photo!

However I get to be shown this:

what am I doing wrong?

thank you.

I have to do that on 6 websites and I’m tuck with that

(Lukas Winkler) #4


You need to paste _paq.push([‘requireConsent’]); into the existing tracking code before the existing trackPageview line.

But the new consent feature doesn’t work as you’d expect. You need to build the banner and the interaction yourself, the Matomo consent feature just handles the storage of the consent and the not-tracking before the consent has been given.


Ok, thank you and how do I build such a banner?


I guess I just hire one to do that. thanks

(Lukas Winkler) #7


This depends fully on how your website works. Matomo can’t provide a solution for every website.

But as mentioned here, you need to call _paq.push(['rememberConsentGiven']); once someone clicks on the accept-button.


ok thank you! I will just hire someone than!


It would be useful if the WP-Piwik wordpress plugin by André Bräkling could provide the banner, in the same way as the opt-out iframe. Is André in the forum?

HOw to embed security notice to wordpress
(Lukas Winkler) #10

That would be a cool feature, but probably not that quickly to implement.

@AndreB, what do you think?


Sounds like a good idea. I have to handle a bug report I got yesterday, so I can also have a look at this. If somebody can provide a sample code for the banner itself, this would be very helpful.

Btw. is to ask for consent mandatory? Afaik it is sufficient to offer the tracking opt-out and to enable IP anonymization?


In my Piwik/Matomo setup I anonymize the last 2 octects of the IP address, obey DoNotTrack, don’t use web logs and offer opt-out in a dedicated dataprotection page. As I understand, I don’t need consent. But in Italy we are waiting the transition law integrating GDPR with the previous privacy law, the cookie law etcetera, so having an integrated way of providing information and recording consent is going to be handy.


I found an old wordpress plugin that tries to manage consent and opt-out: No Piwik for me — Plugin di WordPress

(Lukas Winkler) #14


If depends on if you go with consent (then you can store more personal data) or legitimate interest (then you are not allowed to track personal data)

You can find more details here and in all other recent blog posts on the matomo blog:


I agree, I would very much enjoy that feature.