Jump to content

MatomoWire - embedding Matomo


Recommended Posts

As we often use Matomo (former known as Piwik) instead of Google Analytics we wanted to embed Matomo not only in the template code but also via the ProcessWire backend.
That's why I developed a tiny module for the implementation.

The module provides the possibility to connect to an existing Matomo installation with the classical site tracking and also via the Matomo Tag Manager.
If you have also PrivacyWire installed, you can tell MatomoWire to only load the script, if the user has accepted cookies via PrivacyWire.

To offer an Opt-Out solution you can choose between the simple Opt-Out iFrame, delivered by your Matomo installation, or a button to choose cookies via PrivacyWire.

You'll find the module both in the module directory and via github:



Edited by joshua
Added Links, removed alpha status
  • Like 13
  • Thanks 3
Link to comment
Share on other sites

On 11/25/2020 at 12:09 PM, joshua said:

we wanted to embed Matomo not only in the template code but also via the ProcessWire backend

Funny, just played around with matomo this week. What do you mean exactly? Do you have a screenshot to get an idea? ? 

Thx for sharing!

Link to comment
Share on other sites

  • 1 month later...
  • 1 year later...

We try to switch from MATOMO direct embedding to the MATOMO tag manager.

I am wondering right now how to use the Matomo Tag Manager correctly. Has anyone expericence with this already?

We intend not to block the Tag Manager itself but want to be able tags (like Facebook) inside of it. I don't believe right now that the Tag Manager is a GDPR / DSGVO problem itself. And if this one is blocked, every tag inside is blocked too, which makes a fine-grained selection not possible to the user.

But I need to be able to set up rules in PrivacyWire that toggles activation of used tags inside of the Tag Manager. But how?

Link to comment
Share on other sites

  • 1 month later...

Some things may be obvious for some experienced coders, but not for idiots like me.

On the module page (https://processwire.com/modules/matomo-wire/) there ist short description what to do: "This module requires an installed Matomo instance. Insert your Matomo URL and the Site ID or Tag Manager Container ID of the current website."

As I am using matomo for the first time, I had to struggle until it woked as expected.

Fist of all I had a network error 400 while matomo tried to send the data to the matomo installation (mydomain.com/matomo/). Finally I got the point. When you install matomo, u are getting an embedding code.  From this line "_paq.push(['setSiteId', '1']);" you have to copy the ID to the Backend... sceenshot below...



Second. I you are using Hanna Code and the "matomowire-opt-out" tag, the MatomoWire Textformatter has to be first. Or you change the open and close tags to... lets say {{ and }}...


  • Like 1
Link to comment
Share on other sites

  • 4 months later...

does this work for piwik.pro too? or is it the same thing?
If so, is there a way to handle the Privacy Settings Script? And the Collected Data Handling Script? both from piwik.pro
And then, how can I check if it's working? I can see the pk-cookies in the console, but after opting out of statistics-cookies (I use PrivacyWire) the cookies are still there. Is that normal?

Thanks for help!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...