This bundle allows you to integrate Plausible analytics statistics into the Sulu administration interface via an embedded iframe.
- β Display Plausible statistics in Sulu admin
- β Configuration via environment variables
- β Support for custom Plausible instances
- β Interface integrated with Sulu design
- β Responsive and optimized for administration
- β Multilingual support (English/French)
- β Translation system using Sulu standards
- Install the bundle with composer
composer require pixelopen/sulu-plausiblebundle
- Create the file plausible.yaml in the config/packages folder
plausible:
domain: '%env(PLAUSIBLE_DOMAIN)%'
base_url: '%env(default:plausible_default_url:PLAUSIBLE_BASE_URL)%'
auth_key: '%env(PLAUSIBLE_AUTH_KEY)%'
parameters:
plausible_default_url: 'https://plausible.io'
- Configure the environment variables in your
.env
file:
# Plausible Configuration
PLAUSIBLE_DOMAIN=your-domain.com
PLAUSIBLE_BASE_URL=https://plausible.io
PLAUSIBLE_AUTH_KEY=your-auth-key
- Add the plausible.js file to the assets/admin folder located in the vendor/pixelopen/sulu-plausiblebundle/src/Resources/js/plausible.js folder.
- Add plausible script on app.js to the asset/admin folder :
import './plausible';
- Install all npm dependencies and build the admin UI (see all options):
cd assets/admin
npm install
npm run build
PLAUSIBLE_DOMAIN
: The domain configured in Plausible (required)PLAUSIBLE_BASE_URL
: The base URL of your Plausible instance (default: https://plausible.io)PLAUSIBLE_AUTH_KEY
: Authentication key for shared links (optional but recommended)
You can customize the configuration in config/packages/plausible.yaml
:
plausible:
domain: 'my-site.com'
base_url: 'https://analytics.my-domain.com'
auth_key: '%env(PLAUSIBLE_AUTH_KEY)%'
- Log in to the Sulu administration
- Add permission from User roles
- Click on "Statistics" in the navigation menu
- Statistics are displayed in an integrated iframe
- Sulu CMS ^2.6
- PHP ^8.2
- A Plausible account with a configured domain
- Public sharing enabled in Plausible for your site
The bundle includes full translation support:
- English (
admin.en.json
) - French (
admin.fr.json
)
plausible.statistics
- Main navigation titleplausible.configuration_missing
- Error message for missing configplausible.domain_not_configured
- Domain configuration errorplausible.check_env_variable
- Environment variable check messageplausible.domain
- Domain labelplausible.statistics_for
- Iframe title with domain interpolation
To add support for additional languages, create new translation files:
src/Resources/translations/admin.{locale}.json
- Ensure that public sharing is enabled in your Plausible settings
- The iframe uses the parameters:
embed=true&theme=light&background=transparent
- The bundle automatically integrates into the administration navigation
- All user-facing text uses Sulu's translation system for internationalization support