mirror of
https://github.com/jackyzha0/quartz.git
synced 2025-12-24 05:14:06 -06:00
SPA support
This commit is contained in:
parent
1446d5d2cf
commit
7fd5e7ce59
@ -209,6 +209,14 @@ function addGlobalPageResources(ctx: BuildCtx, componentResources: ComponentReso
|
|||||||
matomoScript.innerHTML = \`
|
matomoScript.innerHTML = \`
|
||||||
var _paq = window._paq = window._paq || [];
|
var _paq = window._paq = window._paq || [];
|
||||||
var currentUrl = location.href;
|
var currentUrl = location.href;
|
||||||
|
// https://developer.matomo.org/guides/spa-tracking
|
||||||
|
|
||||||
|
// Track SPA navigation
|
||||||
|
document.addEventListener("nav", () => {
|
||||||
|
_paq.push(['setCustomUrl', location.pathname]);
|
||||||
|
_paq.push(['setDocumentTitle', document.title]);
|
||||||
|
_paq.push(['trackPageView']);
|
||||||
|
});
|
||||||
|
|
||||||
_paq.push(['trackPageView']);
|
_paq.push(['trackPageView']);
|
||||||
_paq.push(['enableLinkTracking']);
|
_paq.push(['enableLinkTracking']);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user