Skip to content

chore(site): restore Matomo analytics after the Fumadocs migration - #70

Open
justinmclean wants to merge 4 commits into
apache:mainfrom
justinmclean:docs/matomo-analytics
Open

chore(site): restore Matomo analytics after the Fumadocs migration#70
justinmclean wants to merge 4 commits into
apache:mainfrom
justinmclean:docs/matomo-analytics

Conversation

@justinmclean

Copy link
Copy Markdown
Member

No description provided.

@hubcio

hubcio commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

I think this closes #23 ?

Comment thread src/components/matomo.tsx
const url = window.location.origin + pathname + (query ? `?${query}` : "");

window._paq = window._paq || [];
window._paq.push(["setReferrerUrl", document.referrer]);

@hubcio hubcio Aug 31, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no-op as written - matomo.js already sends document.referrer as urlref on every request. it matters only when a visit times out and a client-side nav starts a new one, re-crediting the external site. pass the previous page url from a ref instead.

Comment thread src/components/matomo.tsx
window._paq = window._paq || [];
window._paq.push(["setReferrerUrl", document.referrer]);
window._paq.push(["setCustomUrl", url]);
window._paq.push(["setDocumentTitle", document.title]);

@hubcio hubcio Aug 31, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

on a navigation that wasn't prefetched, the route commits before next's metadata suspense boundary resolves, so document.title is empty here and matomo records an empty title. read the title after it settles.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants