Skip to content

feat: add Plausible analytics with 404 tracking#179

Merged
agraebe merged 4 commits into
mainfrom
reo-third-party-tracking
Jun 2, 2026
Merged

feat: add Plausible analytics with 404 tracking#179
agraebe merged 4 commits into
mainfrom
reo-third-party-tracking

Conversation

@agraebe
Copy link
Copy Markdown
Contributor

@agraebe agraebe commented Jun 2, 2026

Summary

  • Adds Plausible analytics to the Mintlify docs site via integrations.plausible.domain in docs.json
  • Adds plausible-404.js — a global script that fires a custom 404 Plausible event when a visitor hits a missing page, per the Plausible 404 tracking guide

Setup required in Plausible dashboard

The 404 custom goal has already been added to the Plausible dashboard. No further action needed.

Test plan

  • Deploy and visit a non-existent URL (e.g. /does-not-exist)
  • Confirm the 404 event appears in the Plausible Goals tab with the correct path

🤖 Generated with Claude Code

Configures Plausible via the Mintlify integrations field and adds a
global script that fires a custom 404 event whenever a visitor lands
on a missing page.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Mintlify renders "Page Not Found" as the document title on 404 pages,
not "404".

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The previous window.load approach fired before React hydration set the
page title in Mintlify's Next.js SPA. Switching to a MutationObserver
on <title> ensures the check runs whenever React updates the title,
both on initial load and SPA navigations.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The title is set client-side by React so querySelector('title') returns
null and the MutationObserver never attached. Next.js sets
id="__next_error__" on <html> in the server-rendered HTML for all error
pages, giving a reliable synchronous signal to detect 404s.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@agraebe agraebe merged commit 0a32f3a into main Jun 2, 2026
3 checks passed
@agraebe agraebe deleted the reo-third-party-tracking branch June 2, 2026 22:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant