This is an automated email from the ASF dual-hosted git repository.

rusackas pushed a commit to branch fix/matomo-pageview-logging
in repository https://gitbox.apache.org/repos/asf/superset.git

commit 4ac49db40ad69e3b85f066ce51b6cf8636aa6513
Author: Evan Rusackas <[email protected]>
AuthorDate: Wed Jan 28 09:05:36 2026 -0800

    fix(docs): add consistent dev-mode logging for Matomo page views
    
    The trackEvent helper logged in dev mode, but trackPageView did not,
    making it appear as though only events were being tracked. Added a
    trackPageView helper with consistent logging so developers can verify
    page view tracking is working correctly.
    
    Co-Authored-By: Claude Opus 4.5 <[email protected]>
---
 docs/src/theme/Root.js | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/docs/src/theme/Root.js b/docs/src/theme/Root.js
index 210d99e8ed8..10538df6970 100644
--- a/docs/src/theme/Root.js
+++ b/docs/src/theme/Root.js
@@ -74,6 +74,14 @@ export default function Root({ children }) {
         window._paq.push(['trackSiteSearch', keyword, category, resultsCount]);
       };
 
+      // Helper to track page views
+      const trackPageView = (url, title) => {
+        if (devMode) {
+          console.log('Matomo trackPageView:', { url, title });
+        }
+        window._paq.push(['trackPageView']);
+      };
+
 
       // Track external link clicks using domain as category (vendor-agnostic)
       const handleLinkClick = (event) => {
@@ -221,7 +229,6 @@ export default function Root({ children }) {
           trackDocsVersion();
 
           if (devMode) {
-            console.log('Tracking page view:', currentPath, currentTitle);
             window._paq.push(['setDomains', ['superset.apache.org']]);
             window._paq.push([
               'setCustomUrl',
@@ -233,7 +240,7 @@ export default function Root({ children }) {
 
           window._paq.push(['setReferrerUrl', window.location.href]);
           window._paq.push(['setDocumentTitle', currentTitle]);
-          window._paq.push(['trackPageView']);
+          trackPageView(currentPath, currentTitle);
 
           // Check for 404 after page renders
           setTimeout(track404, 500);

Reply via email to