Skip to content

feat(analytics): add Plausible CE analytics via PLAUSIBLE_SCRIPT_URL env var - #496

Closed
Neophytis wants to merge 1 commit into
masterfrom
neophytis/plausible-analytics
Closed

Neophytis wants to merge 1 commit into
masterfrom
neophytis/plausible-analytics

Conversation

@Neophytis

Copy link
Copy Markdown
Contributor

Summary

  • Adds Plausible CE privacy-friendly analytics tracking to all pages via base.html.twig
  • Script URL is injected via PLAUSIBLE_SCRIPT_URL env var — empty by default, so no tracking renders in dev or on any environment where it is not explicitly set
  • Twig global defined in config/packages/twig.yaml using Symfony's %env(default::PLAUSIBLE_SCRIPT_URL)% pattern (empty env var = no output, no errors)

How to enable on an environment

Legacy server (Lynx): add to .env.local on the server, then reload php-fpm:

PLAUSIBLE_SCRIPT_URL=https://analytics.bewelcome.org/js/pa-g99q9guhcQJ--t-zvYsbt.js

Docker (new host): already configured in bewelcome.prod.env in sysadmins-infra.

Test plan

  • Dev: PLAUSIBLE_SCRIPT_URL= (empty) — no script tag rendered in page source
  • Prod: set the env var — <script async src="https://analytics.bewelcome.org/js/..."> appears in <head>
  • Plausible dashboard at analytics.bewelcome.org shows pageview events after a visit

…PT_URL env var

Empty by default (no tracking in dev). Set to the site-specific script URL
at deploy time for stage and prod independently.
@Neophytis Neophytis closed this Sep 11, 2026
@Neophytis

Copy link
Copy Markdown
Contributor Author

Implemented Manually on Lion

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