Add native Top Pages and Traffic Sources with real EmDash screenshots - #3
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add Top Pages and Traffic Sources below the native overview and chart. Both tables show views and visitors for the first ten rows ranked by OpenAnalytics, using the same selected interval and configured timezone as the overview. Source labels retain referrer and UTM attribution without implying session metrics.
Split the admin coordinator into practical range, connection, overview, and report modules. Each analytics read can fail independently: successful metrics, chart, pages, and sources stay visible, with useful empty states and section-specific errors. Suspended sites now say Tracker installed · collection suspended when the installed tracker is enabled.
Keep private credentials server-only, preserve credential-bound tracker snapshots and existing revalidation behavior, validate/project upstream responses, and add no production dependencies. Public rendering still makes no OpenAnalytics read requests.
Screenshots
Captured from an actual running EmDash 1.0.1 admin instance with this plugin installed, authenticated through EmDash's development-only test path. A loopback HTTP OpenAnalytics fixture supplies synthetic connection metadata, comparison totals, chart points, pages, and sources. No production account or credential is used.
Overview
Top Pages and Traffic Sources
Narrow viewport
Run
pnpm screenshotto reproduce all three captures. The harness creates an isolated temporary SQLite database, starts EmDash and the HTTP fixture on reserved loopback ports, configures and validates the plugin through protected admin routes, waits for actual content and a stable chart canvas, then scans HTML, DOM, browser responses, logs, and screenshot artifacts before retaining images. A separate CI job runs the same workflow and uploads the captures. PNG scanning is supplemented by DOM/HTML checks; it is not OCR.Testing
pnpm checkpasses locally on Node 22.23.2 and Node 24.18.0: tests, typecheck, lint, formatting, build, package verification, npm dry run, and packed-artifact credential scanning.Implementation footprint
Supported endpoints: site metadata, overview, timeseries, pages, and sources. The six added development dependencies run the real EmDash host and Playwright; the plugin remains native Block Kit with no browser application. Demo code and screenshots are excluded from the seven-file npm package.
docs/implementation-footprint.mdretains the concrete comparison with the Black Swamp AI n8n node and explains their different responsibilities.Current contract details and pinned upstream references are in
docs/upstream-contracts.md. OpenAnalytics sources are referrer/UTM tuples with views and distinct visitors; page session decorations can be null, especially for imported or incomplete data. The compact tables intentionally omit session fields. Native EmDash charts format timestamps in the browser timezone while analytics bucket/query timezone remains explicit; the page explains this. Native tables handle overflow, and screenshot automation accounts for EmDash's inner scroll container.Scope
This PR adds only the two summary reports, practical admin organization, resilience improvements, and reproducible real-UI captures. Geography, devices, session/visitor browsing, custom events, funnels, revenue, web vitals, realtime, editor analytics, OAuth, account/site creation, pagination, custom filters, campaign building, and automatic polling remain out of scope.
Nothing has been published to npm. This PR is ready for review and is not automatically merged.