Skip to content

[fix](website) Count initial Matomo pageviews once and isolate browser checks - #4567

Merged
morningman merged 2 commits into
apache:masterfrom
morningman:fix/matomo-pageviews
Oct 31, 2026
Merged

morningman merged 2 commits into
apache:masterfrom
morningman:fix/matomo-pageviews

Conversation

@morningman

Copy link
Copy Markdown
Contributor

The Matomo plugin records an initial HTML pageview and then records it again during Docusaurus hydration. It also enables the production tracker when a compiled site is previewed on localhost. This makes initial PVs and browser verification traffic enter the production report.

Keep the upstream tracker initialization and replace its route handler with a local adapter. Skip the initial route callback, count committed pathname/query changes once, preserve queries, and ignore document anchors. Read page titles after Helmet's deferred head update. Load the tracker only on the configured production origin and exclude browsers exposing WebDriver.

The browser regression uses real English/Chinese Docusaurus builds with a tracker double and fulfills every browser request locally. It covers direct home/document loads, SPA navigation, history, anchors, language reloads, previews and automated browsers. CI runs it with the publishing fixtures, including when only the adapter changes.

Validation

  • 46 tests passed, zero skips: publishing tests with Apache enabled, CI scope tests and Slack attribution tests.
  • The English/Chinese production browser fixture passed. Direct loads record one PV; SPA changes/history each add one; anchors add none; a language reload records one initial PV. Local/staging/WebDriver cases load no tracker.
  • Browser checks also verify the destination query and updated page title.
  • git diff --check passed. The full website was not rebuilt locally.

Self-review

  • Goal: remove duplicate initial PVs and keep known browser checks out of production analytics; regression checks cover both.
  • Scope: analytics adapter, validation and CI selection only.
  • Information architecture: common tracking applies to every active version and locale; per-language content edits are unnecessary.
  • URLs/navigation: route targets retain their existing behavior; query strings are included in SPA analytics and document anchors do not create PVs.
  • Frontend/build/workflows: retain the upstream tracker settings, SSR guards, build entry points, workflow permissions and browser-tool installation.
  • Validation: tests exercise the generated HTML and actual Docusaurus lifecycle, plus existing integration coverage.
  • Other checks: no additional issues found. WebDriver detection does not identify automation that conceals itself or sends tracking requests directly. Mark the deployment date when comparing PV/bounce-rate trends; historical PVs cannot be corrected with a uniform divisor.

Versions

  • dev
  • 4.x
  • 3.x
  • 2.1 or older (not covered by version/language sync gate)

Languages

  • Chinese
  • English

The common adapter also covers Japanese, Korean and Russian.

Docs Checklist

  • Checked by AI
  • Test Cases Built
  • Updated required version and language counterparts, or explained why not
  • If only one language changed, confirmed whether source/translation counterparts need sync

@morningman
morningman merged commit e7a4422 into apache:master Oct 31, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant