feat(analytics): enhance Plausible tracking with journey context#3169
feat(analytics): enhance Plausible tracking with journey context#3169MarkusNeusinger merged 3 commits intomainfrom
Conversation
…new events - Add page property to copy_code and download_image for user journey tracking (home, spec_overview, spec_detail) - Add toggle_grid_size event for view preference tracking - Add filter_remove event for filter removal tracking - Add spec property to SpecTabs copy_code (was missing) - Reduce debounce times: pageview 300ms→150ms, search_no_results 500ms→200ms - Move and update plausible.md documentation with Plausible dashboard setup guide 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR enhances Plausible Analytics tracking by adding journey context to understand where users perform actions. It introduces the page property to distinguish user actions across different views (home, spec_overview, spec_detail), adds two new tracking events for UI interactions, fixes a missing property bug, optimizes event capture timing, and provides comprehensive documentation.
Key changes:
- Added
pageproperty tocopy_codeanddownload_imageevents for journey tracking - Implemented
toggle_grid_sizeandfilter_removeevents for better user behavior insights - Reduced debounce times (pageview: 300ms→150ms, search_no_results: 500ms→200ms) for faster tracking
- Fixed missing
specproperty in SpecTabscopy_codeevent
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| docs/architecture/plausible.md | Comprehensive Plausible documentation with event catalog, custom properties reference, and dashboard setup guide |
| app/src/hooks/useAnalytics.ts | Reduced pageview debounce from 300ms to 150ms for faster tracking |
| app/src/components/FilterBar.tsx | Added toggle_grid_size event tracking and reduced search_no_results debounce to 200ms |
| app/src/components/ImageCard.tsx | Added page: 'home' property to copy_code event |
| app/src/pages/SpecPage.tsx | Added page property (spec_overview/spec_detail) to copy_code and download_image events |
| app/src/components/SpecTabs.tsx | Fixed missing spec property and added page: 'spec_detail' to copy_code event |
| app/src/hooks/useFilterState.ts | Added filter_remove event tracking for individual filter and group removals |
| | Event Name | Properties | Where | Description | | ||
| |------------|-----------|-------|-------------| | ||
| | `search` | `query`, `category` | FilterBar | User searches and selects value | | ||
| | `search_no_results` | `query` | FilterBar | Search query returns no results (debounced 500ms) | |
There was a problem hiding this comment.
The debounce time in the documentation is outdated. According to the code changes in FilterBar.tsx, the debounce time has been reduced from 500ms to 200ms. The documentation should be updated to reflect this change.
| | `search_no_results` | `query` | FilterBar | Search query returns no results (debounced 500ms) | | |
| | `search_no_results` | `query` | FilterBar | Search query returns no results (debounced 200ms) | |
|
|
||
| ### `library` Values | ||
| ``` | ||
| matplotlib | seaborn | plotly | bokeh | altair | plotnine | pygal | highcharts | letsplot |
There was a problem hiding this comment.
The library name should be "lets-plot" (with a hyphen), not "letsplot". This is inconsistent with the rest of the codebase where it's consistently spelled as "lets-plot".
| matplotlib | seaborn | plotly | bokeh | altair | plotnine | pygal | highcharts | letsplot | |
| matplotlib | seaborn | plotly | bokeh | altair | plotnine | pygal | highcharts | lets-plot |
Summary
pageproperty tocopy_codeanddownload_imageevents to distinguish where users perform actions (home,spec_overview,spec_detail)toggle_grid_size(view preference),filter_remove(filter removal tracking)specproperty to SpecTabscopy_codeeventpageview: 300ms → 150mssearch_no_results: 500ms → 200msChanges
useAnalytics.tsFilterBar.tsxtoggle_grid_size, reduced search debounceImageCard.tsxpage: 'home'to copy_codeSpecPage.tsxpageto copy_code and download_imageSpecTabs.tsxspecandpageto copy_codeuseFilterState.tsfilter_removeeventdocs/architecture/plausible.mdPlausible Dashboard Setup Required
After merge, register these custom properties in Plausible:
Test plan
pageproperty in different contexts🤖 Generated with Claude Code