Skip to content

docs(site): add self-hosted page tracker via Cloudflare Worker, drop GoatCounter#9430

Merged
jdx merged 4 commits intomainfrom
plausible-analytics
Apr 27, 2026
Merged

docs(site): add self-hosted page tracker via Cloudflare Worker, drop GoatCounter#9430
jdx merged 4 commits intomainfrom
plausible-analytics

Conversation

@jdx
Copy link
Copy Markdown
Owner

@jdx jdx commented Apr 27, 2026

Summary

  • Add a self-hosted page tracker proxied through a Cloudflare Worker at shrill.en.dev. Following the upstream proxy guide, the Worker exposes the script at /shrill/script.js and the event endpoint at /f5f1/event so neither path matches well-known content-blocker heuristics.
  • Configure via data-domain="mise.en.dev" and data-api="https://shrill.en.dev/f5f1/event" on the script tag — pageview tracking is automatic, so no inline init block is needed.
  • Keep GTM unchanged.
  • Remove GoatCounter.

Test plan

  • Confirm https://shrill.en.dev/shrill/script.js loads (200) and https://shrill.en.dev/f5f1/event records the pageview (POST 202).
  • Confirm GTM (gtag/js?id=G-B69G389C8T) still loads.
  • Confirm no GoatCounter requests remain.

🤖 Generated with Claude Code

Replace Google Tag Manager and GoatCounter with a self-hosted Plausible
proxy at shrill-1.en.dev. The proxy follows Plausible's recommended
Cloudflare Worker pattern (separate paths for the script and event
endpoint to evade ad-blocker heuristics).

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Apr 27, 2026

Greptile Summary

This PR replaces the GoatCounter analytics script with a Plausible script routed through a Cloudflare Worker proxy. Beyond the proxy hostname discrepancy flagged below, previously raised reviews noted that the GTM scripts are still present and data-domain is set to mise.en.dev rather than the canonical mise.jdx.dev; those issues remain unresolved in the current diff.

Confidence Score: 3/5

Multiple unresolved analytics configuration issues mean this PR will likely not record pageviews correctly after merge.

Three P1-level issues exist: GTM not removed (contradicts stated intent), wrong data-domain (mise.en.dev vs mise.jdx.dev), and proxy hostname mismatch (shrill.en.dev vs shrill-1.en.dev in description). Any one of these would silently break pageview tracking.

docs/.vitepress/config.ts — verify the correct Cloudflare Worker hostname, set data-domain to the registered Plausible site domain, and remove the GTM blocks if they are no longer needed.

Important Files Changed

Filename Overview
docs/.vitepress/config.ts Swaps GoatCounter for Plausible via Cloudflare Worker proxy, but GTM scripts remain, data-domain uses mise.en.dev instead of the canonical mise.jdx.dev, and the proxy hostname in code (shrill.en.dev) doesn't match the description (shrill-1.en.dev)

Sequence Diagram

sequenceDiagram
    participant Browser
    participant CloudflareWorker as Cloudflare Worker (shrill.en.dev)
    participant Plausible as Plausible Server

    Browser->>CloudflareWorker: GET /shrill/script.js
    CloudflareWorker-->>Browser: Plausible tracking script

    Browser->>CloudflareWorker: POST /f5f1/event (pageview)
    CloudflareWorker->>Plausible: Forward event for mise.en.dev
    Plausible-->>CloudflareWorker: 202 Accepted
    CloudflareWorker-->>Browser: 202 Accepted
Loading

Fix All in Claude Code

Reviews (4): Last reviewed commit: "docs(site): use shrill.en.dev as proxy h..." | Re-trigger Greptile

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request replaces Google Analytics and GoatCounter with a Plausible analytics implementation proxied through a Cloudflare Worker. The review feedback highlights that the script tag is missing the necessary 'data-domain' and 'data-api' attributes required for Plausible to correctly identify the site and route events. Additionally, it is recommended to simplify the manual initialization script to the standard Plausible helper to ensure compatibility and automatic tracking.

Comment thread docs/.vitepress/config.ts Outdated
{
async: "",
src: "https://www.googletagmanager.com/gtag/js?id=G-B69G389C8T",
src: "https://shrill-1.en.dev/shrill/script.js",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The Plausible script requires a data-domain attribute to identify the site in your dashboard. Additionally, since you are using a custom path for the event endpoint (/f5f1/event), you should specify the data-api attribute on the script tag. This is the standard way to configure Plausible with a proxy and ensures that the script correctly routes events through your Cloudflare Worker.

          "data-domain": "mise.jdx.dev",
          "data-api": "https://shrill-1.en.dev/f5f1/event",
          src: "https://shrill-1.en.dev/shrill/script.js",

Comment thread docs/.vitepress/config.ts Outdated
Comment on lines +373 to +376
`window.plausible=window.plausible||function(){(plausible.q=plausible.q||[]).push(arguments)},plausible.init=plausible.init||function(i){plausible.o=i||{}};
plausible.init({
endpoint: "https://shrill-1.en.dev/f5f1/event"
})`,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

This manual initialization script is non-standard for the official Plausible script and is missing the required domain property. If the script tag above is correctly configured with data-domain and data-api, the official script will automatically handle pageview tracking. You can simplify this block to the standard Plausible helper, which allows you to trigger manual events later if needed.

        `window.plausible = window.plausible || function() { (window.plausible.q = window.plausible.q || []).push(arguments) }`

jdx and others added 2 commits April 27, 2026 10:16
Configures the script via data-domain and data-api attributes (per the
proxy guide) so pageview tracking works automatically. Drops the inline
init block, removing the only spot where the well-known global name
appeared in served HTML.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Keep GTM alongside the new tracker; only GoatCounter is removed.
Use mise.en.dev as the configured site domain.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Comment thread docs/.vitepress/config.ts
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Comment thread docs/.vitepress/config.ts
Comment on lines +382 to 384
"data-api": "https://shrill.en.dev/f5f1/event",
src: "https://shrill.en.dev/shrill/script.js",
},
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Proxy hostname mismatch vs PR description

The PR description says the Cloudflare Worker is reachable at shrill-1.en.dev, but the actual script src and data-api both point to shrill.en.dev (no -1). If the worker is only deployed at shrill-1.en.dev, the script will 404 and no pageviews will be recorded.

Fix in Claude Code

Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit bf02c04. Configure here.

Comment thread docs/.vitepress/config.ts
rel: "stylesheet",
},
],
// Analytics
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GTM scripts not removed despite stated intent

High Severity

The PR intended to replace Google Tag Manager (GTM) and GoatCounter with Plausible. While GoatCounter was removed, the GTM scripts (loader and inline gtag() initialization) remain in the head array. This results in dual analytics tracking, with both GTM and Plausible firing.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit bf02c04. Configure here.

Comment thread docs/.vitepress/config.ts
defer: "",
"data-domain": "mise.en.dev",
"data-api": "https://shrill.en.dev/f5f1/event",
src: "https://shrill.en.dev/shrill/script.js",
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Proxy domain mismatch between code and PR description

High Severity

It looks like the analytics script's src and data-api attributes reference shrill.en.dev, but the PR description indicates the Cloudflare Worker proxy is deployed at shrill-1.en.dev. This mismatch means the analytics script won't load and events won't be recorded, leading to silently broken analytics.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit bf02c04. Configure here.

@jdx jdx changed the title docs(site): switch analytics to Plausible via Cloudflare Worker proxy docs(site): add self-hosted page tracker via Cloudflare Worker, drop GoatCounter Apr 27, 2026
@jdx jdx merged commit ad02750 into main Apr 27, 2026
27 checks passed
@jdx jdx deleted the plausible-analytics branch April 27, 2026 15:26
@github-actions
Copy link
Copy Markdown

Hyperfine Performance

mise x -- echo

Command Mean [ms] Min [ms] Max [ms] Relative
mise-2026.4.24 x -- echo 24.4 ± 0.8 23.4 31.5 1.00 ± 0.04
mise x -- echo 24.4 ± 0.3 23.6 26.1 1.00

mise env

Command Mean [ms] Min [ms] Max [ms] Relative
mise-2026.4.24 env 23.2 ± 0.5 22.5 27.7 1.00
mise env 23.9 ± 0.8 23.2 35.0 1.03 ± 0.04

mise hook-env

Command Mean [ms] Min [ms] Max [ms] Relative
mise-2026.4.24 hook-env 24.2 ± 0.6 23.4 29.4 1.00
mise hook-env 25.0 ± 0.7 23.9 33.8 1.03 ± 0.04

mise ls

Command Mean [ms] Min [ms] Max [ms] Relative
mise-2026.4.24 ls 24.9 ± 0.6 23.8 26.7 1.00
mise ls 25.6 ± 1.0 24.6 36.2 1.03 ± 0.05

xtasks/test/perf

Command mise-2026.4.24 mise Variance
install (cached) 159ms 166ms -4%
ls (cached) 81ms 84ms -3%
bin-paths (cached) 83ms 85ms -2%
task-ls (cached) 788ms 796ms -1%

mise-en-dev added a commit that referenced this pull request Apr 28, 2026
### 🚀 Features

- **(task)** add --name-only flag to mise tasks ls by @jdx in
[#9435](#9435)

### 🐛 Bug Fixes

- **(Dockerfile)** install copr-cli via dnf for better dependency
management by @bestagi in [#9421](#9421)
- **(aqua)** drop empty-releases fallback to tags by @jdx in
[#9443](#9443)
- **(docs)** fix theme flicker on docs by @vhespanha in
[#9427](#9427)
- **(lockfile)** update global lockfile on upgrade by @jdx in
[#9442](#9442)
- **(ls-remote)** omit rolling/prerelease from JSON when false by @jdx
in [#9439](#9439)
- **(task)** support usage refs in dependency template tags by @jdx in
[#9424](#9424)
- **(task)** populate usage.cmd for subcommand-only tasks; share
make_usage_ctx by @jdx in [#9431](#9431)
- **(task)** resolve sandbox allow_read/allow_write against task dir by
@jdx in [#9428](#9428)

### 📚 Documentation

- **(site)** add self-hosted page tracker via Cloudflare Worker, drop
GoatCounter by @jdx in [#9430](#9430)

### New Contributors

- @vhespanha made their first contribution in
[#9427](#9427)

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
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