Copilot commented on code in PR #37526:
URL: https://github.com/apache/superset/pull/37526#discussion_r2737961726
##########
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:
The `trackPageView` helper accepts `url` and `title` parameters that are
only used for dev-mode logging, not for the actual Matomo tracking call. The
actual tracking uses values previously set via `setDocumentTitle` and
`setCustomUrl` calls. This could be confusing because:
1. The function signature suggests these parameters affect tracking behavior
2. In dev mode, the logged `url` value (e.g., `/docs/databases/bigquery`)
differs from what's actually tracked (e.g.,
`https://superset.apache.org/docs/databases/bigquery` - see lines 234-236)
Consider either:
- Removing the parameters and logging generic information like "Page view
tracked"
- Or using the parameters in the Matomo call:
`window._paq.push(['trackPageView', title])` (though this would require
restructuring the code to not use `setDocumentTitle`/`setCustomUrl` separately)
```suggestion
window._paq.push(['trackPageView', title]);
```
--
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]