Where will I add my code

I have Matomo installed in my blog, but I have two separates installation where no plugin is available. My forum and my Photo gallery. It says so: “If you can not find a plugin you can edit the site templates and add the code to the </ head> tag. It is often found in ‘header.php’, ‘header.tpl’ or similar files.” I can´t find any files with header os´r some who have inside, maybe I have miss it, but I have looked in all files. Where will i add the code? The forum is SMF and the photo gallery is Piwigo.
Thanks for help.