rusackas commented on code in PR #37526:
URL: https://github.com/apache/superset/pull/37526#discussion_r2738276352


##########
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']);

Review Comment:
   This is intentional and matches the pattern of the sibling helpers 
(`trackEvent`, `trackSiteSearch`) where parameters serve both the Matomo call 
*and* the dev-mode log.
   
   For `trackPageView`, Matomo's API requires `setCustomUrl` and 
`setDocumentTitle` to be pushed separately *before* the `trackPageView` call 
(which just triggers the beacon). The `url` and `title` parameters are passed 
to the helper so the dev-mode log shows what's being tracked without having to 
re-derive those values at the call site.
   
   The Copilot suggestion to pass `title` directly to `trackPageView` would 
actually set the title *twice* (once via `setDocumentTitle`, once via the 
`trackPageView` arg), and wouldn't help with the URL since `trackPageView` 
doesn't accept a URL parameter — that's what `setCustomUrl` is for.
   
   No change needed here.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to