Anonymise Matomo domain inside the Javascript Tracking Code

I am using Matomo daily and have the same https://www.domain.com/matomo-folder/ to track multiple different websites.

I use the JavaScript Tracking Code to setup the domains with Matomo tracking.

For a privacy and open-source focused Analytics, I would LOVE to be able to anonymize the Matomo domain used, instead of having it shown in the code - i.e. maybe it can be encrypted, maybe the whole JS can be encrypted or only the https://www.domain.com/matomo-folder/ can be encrypted.

If I am doing this wrong and there is a way to do it, please do tell : )

1 Like

Hi @metrprime
I donā€™t really understand what you would like to do, as web tracking is done client-side, then if you look at the network console of the browser, you will ever be able to see the matomo server.

To achieve your wish, you can:

Use the Protect Track ID plugin

In order to protect idSite using hash instead default numeric.

Track using servers logs

Track using server-side API

Then client tracking is done through the API of your main app, and transferred to the Matomo server, like a kind of proxy.

@heurteph-ei can I just say THANK YOU! I had no idea i can use this plugin to hash the Matomo domain used for tracking, when using JS code.

OMG! this is EXACTLY what I was looking for, thank you sooooo soo much!

Thank you for the other suggestions as well, Iā€™ll be dwelling into them as well to test them out.

Thank you!

@metrprime Are you sure that it masks domain?
Because you selected as ā€˜Solutionā€™, I installed the plugin, but it didnā€™t mask the domain, it only masks SiteId.
I donā€™t care SiteId, I want to mask the domain. Any suggestion for solution?

yes it works, just checked my notes and setup, itā€™s a bit of figgling around with it. If you are still seeing the domain, you missed a step. Go back and check your PHP version, make sure you have all u need, check here plugin github: https://github.com/joubertredrat/Matomo-ProtectTrackID

Make sure u satisfy dependencies:

  • PHP 7.3.5 or above
  • bcmath, gmp and mbstring extensions

PHP is 8, gmp was not active, I activated, so all 3 extensions are active now, but I still see domain. Anything missing?
Actually, both plugin name and github description only mentions about protecting ā€˜idSiteā€™.

so the javascript code you are gonna use will use the domain name itself, i.e. lets say matomo-server.com is the one you have where you keep your Matomo, and client.com is the domain where you install the Javascript.

The Javascript itself will have only ā€œclient.comā€ and the siteID as a number in it from what I recall, but it wonā€™t have ā€œmatomo-server.comā€.

Nobody knows the actual matomo-server.com, that gets protected at the server level in the JS script.

No, I see the main matomo-installed-domain in the JS code, neither client domain nor a masked domain.
Can you check your own JS code?

i donā€™t think you will be able to see a masked domain, you gonna see the actual domain that it is installed on, i.e. ā€œclient.comā€ in the code. Thatā€™s when it shows it works fine.

I am ok if it shows client-domain, but I see matomo-installed-domain in all JS tracking codes.
Have you checked your own JS code?

yes checked the server on my end and code , shows only client-domain.

are you saying u are seeing the server domain in the code?

Yes.
Have you applied any other method other than Protect Track ID plugin?
You are using On-Premise, right?
How can it be possible to have different results?