Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ layouts/case-studies/immersive.html
layouts/case-studies/single.html
layouts/case-studies/_markup/render-link.html
layouts/partials/case-study-entry.html
layouts/partials/plausible.html
2 changes: 2 additions & 0 deletions layouts/partials/head.html
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,8 @@
src="//static.klaviyo.com/onsite/js/klaviyo.js?company_id=TTc7Za"
></script> -->

{{ partial "plausible.html" . }}

<!-- Google tag (gtag.js) -->
<script
type="text/plain"
Expand Down
27 changes: 27 additions & 0 deletions layouts/partials/plausible.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{{/*
Plausible Analytics.

Deliberately NOT consent-gated. Unlike the GA4/GTM blocks in head.html,
Plausible is cookieless and stores no personal data, so it does not require
consent. Adding type="text/plain" + data-category="analytics" here would make
it inherit the CookieConsent gate and defeat the reason we added it: seeing
the traffic GA4 never sees.

Served through the first-party proxy defined in netlify.toml so ad blockers
don't strip it. The paths below MUST stay in sync with those redirect rules.

Scroll depth and time-on-page are tracked automatically, no config needed.
*/}}
{{ if eq (os.Getenv "HUGO_ENV") "production" }}
<!-- Privacy-friendly analytics by Plausible -->
<script async src="/mpx/js/script.js"></script>
<script>
window.plausible=window.plausible||function(){(plausible.q=plausible.q||[]).push(arguments)},plausible.init=plausible.init||function(i){plausible.o=i||{}};
plausible.init({
endpoint: "/mpx/api/event",
outboundLinks: true,
fileDownloads: true,
formSubmissions: true
})
</script>
{{ end }}
17 changes: 17 additions & 0 deletions netlify.toml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,23 @@ status = 301
force = true
########################################################

########################################################
# Plausible Analytics proxy. Serves the tracker first-party so ad blockers
# don't strip it. These MUST stay above the catch-all 404 below, and the paths
# MUST match the script src + endpoint in layouts/partials/plausible.html
[[redirects]]
from = "/mpx/js/script.js"
to = "https://plausible.io/js/pa-J584RNJ6fxr4nE6Fry8ys.js"
status = 200
force = true

[[redirects]]
from = "/mpx/api/event"
to = "https://plausible.io/api/event"
status = 200
force = true
########################################################

[[redirects]]
from = "/*"
to = "/404.html"
Expand Down