Is this code all by itself in a .php file?
If so, you need to start with the phplugins-pangolin-sample.php file and add your code to the user area.
You can download the file from your site in the /backlight/modules/custom-resources/phplugins/ file. After editing, upload to the /backlight/custom/phplugins/ folder.
Can you post a link to a page where it’s not working?
I copied the file phplugins-pangolin-sample.php and added the function as decribed.
then I activated the phplugin at every pagetemplate and choosed the new php File.
I deleted the comment area for better readability. Could this be the reason?
if the example works, i will add a matomo tracking script at the head-section…
If you delete the wrong thing in that file, things might not work as expected. There is code at the beginning that is required.
My guess is that when you deleted commented content you may have also deleted lines 10-24 (or maybe even the opening php tag), which contain the code required to make it all work. Or, because of other deletions in the file, the same code may be commented out.
Can you copy and paste the content of the file here?