I’ve successfully followed the instructions at GitHub - matomo-org/tracker-proxy: HTTP proxy for Matomo's tracker API. This script allows to track websites with Matomo without revealing to your visitors the secret Matomo server URL. to implement the tracker proxy on my sites. This setup embeds the standard Matomo tracker to the website.
How can I go about doing the same with the Matomo Tag Manager instead of the standard tracking script? I am at a loss because Tag Manager containers are js files, not php, and therefore don’t seem to fit in the tracker proxy snippet (see line 6):
(function() {
var u="//trackedsite.com/";
_paq.push(["setTrackerUrl", u+"piwik.php"]);
_paq.push(["setSiteId", "trackedsite-id"]);
var d=document, g=d.createElement("script"), s=d.getElementsByTagName("script")[0];
g.type="text/javascript"; g.async=true; g.defer=true; g.src=u+"piwik.php"; s.parentNode.insertBefore(g,s);
})();
</script>
Thanks