schnti/plausible

Simple plugin providing Plausible iframe panel view to Kirby panel and frontend snippet.

Installs: 2

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 0

Forks: 7

Language:JavaScript

Type:kirby-plugin

pkg:composer/schnti/plausible

1.0.2 2026-02-01 22:32 UTC

This package is auto-updated.

Last update: 2026-02-01 22:32:29 UTC


README

Simple Kirby plugin that

  • embeds Plausible Analytics in the Kirby Panel via an iframe (shared link)
  • adds a frontend snippet tracking page views

plausible screenshot

Commercial Usage

This plugin is free. If you use it in a commercial project, please consider:

Installation

Via Composer:

composer require schnti/plausible

Or download the plugin from the GitHub releases and place it in:

/site/plugins/plausible

Configuration

Add the following to your config/config.php:

'schnti.plausible' => [
  // Required: Shared link for the Panel iframe view
  'sharedLink' => 'https://stats.example.com/share/example.com?auth=XXXXXXXX',

  // Required: Plausible tracking script (signed pa-*.js)
  // This can be plausible.io or a self‑hosted instance
  'script' => 'https://stats.example.com/js/pa-XXXXXXXX.js',
],

Notes

  • The script value should point to the project‑specific (signed) Plausible script (pa-*.js).
  • The plugin assumes Plausible v2+ behavior.

Frontend usage

Add the snippet inside your site’s <head> section:

<?php snippet('plausible'); ?>

Behavior

The snippet outputs nothing when:

  • Kirby is in debug mode
  • a user is logged into the Panel

Panel Analytics View

The plugin adds a new Analytics entry to the Kirby Panel sidebar.

  • Displays Plausible stats via the configured sharedLink
  • Uses an iframe embed
  • Implemented using render() (no runtime template compilation)
  • Does not require unsafe-eval

The Panel view is for visualization only and does not track page views.

Content Security Policy (CSP)

A minimal CSP setup for a self‑hosted Plausible instance might look like this:

script-src 'self' `unsafe-inline` https://stats.example.com;
connect-src https://stats.example.com;
frame-src https://stats.example.com;

No unsafe-eval is required.

Thanks

This plugin is based on the original work by Florian Karsten, many thanks for creating and sharing the foundation for this plugin 🙏