Add site analytics (Umami analytics) script to html header

Nextcloud version (eg, 20.0.5): Nextcloud Hub 6 (27.1.1)
Operating system and version (eg, Ubuntu 20.04): Ubuntu 22.04.3 LTS
Apache or nginx version (eg, Apache 2.4.25): Apache/2.4.52
PHP version (eg, 7.4): 8.1.23

The issue you are facing:

Hello Nextcloud community,
this is my first post right here, don’t be to hard to me.
First of all Nextcloud itself is running great using the lamp stack on a proxmox container behind nginx proxy manager.

I want to add some site analytics to my Nextcloud instance with using https://umami.is/ .
Everything is set up, but I have trouble finding the right place to place the js script they are providing with this app (


).
According to Umami this should be placed into the head section of the html files.
I tried to do so in the /var/www/nextcloud/index.html file but that does not seem to work.

Does anyone have an idea where to place such scripts/ js files that it gets loaded on every site?

This old thread is quite similar but didn’t solve the issue:

There is even a plugin called jsloader which looks like a nice fit. But this is unfortunately not supported anymore.

Help is much appreciated!