Jump to content

MatomoWire - embedding Matomo


joshua
 Share

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:

MatomoWire-1.thumb.png.3b25ca35db91d2ced5e024b92e22e709.png

MatomoWire-2.thumb.png.256a87dc55609353870530944d1bb861.png

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...

grafik.thumb.png.93939b6f52cffa0c606991a8aa17b15c.png

 

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 }}...

grafik.png.8b12d2e9b044943809bf8b2ec83a2c02.png

  • 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

  • 1 year later...

Hi @joshua. I'm developing a little Matomo module myself, which will also have a 'dashboard' in PW to embed various widgets. The plan is to do it so that it is GDPR compliant without any 'unnecessary' cookies. Your code is very similar to what I have done so far. I hope it's OK to borrow some of your code (with credits!). ?

  • Like 1
Link to comment
Share on other sites

On 7/4/2024 at 12:56 PM, Tiberium said:

Are you planning to released it, or is it a more specific develop for your needs?

At the moment it is for my own use, but if I like it I will probably tidy it up and release it.

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
 Share

×
×
  • Create New...