This commit is contained in:
John Barker 2025-07-22 14:55:15 +01:00
parent ff1bb0052b
commit 9cd16902e4

View File

@ -202,8 +202,6 @@ function addGlobalPageResources(ctx: BuildCtx, componentResources: ComponentReso
document.head.appendChild(clarityScript)
`)
} else if (cfg.analytics?.provider === "matomo") {
const siteId = cfg.analytics.siteId
const matomoHost = cfg.analytics.host
componentResources.afterDOMLoaded.push(`
const matomoScript = document.createElement("script");
matomoScript.innerHTML = \`
@ -220,9 +218,9 @@ function addGlobalPageResources(ctx: BuildCtx, componentResources: ComponentReso
_paq.push(['trackPageView']);
_paq.push(['enableLinkTracking']);
(function() {
const u="//${matomoHost}/";
const u="//${cfg.analytics.host}/";
_paq.push(['setTrackerUrl', u+'matomo.php']);
_paq.push(['setSiteId', ${siteId}]);
_paq.push(['setSiteId', ${cfg.analytics.siteId}]);
const d=document, g=d.createElement('script'), s=d.getElementsByTagName
('script')[0];
g.type='text/javascript'; g.async=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s);