PHPackages                             octfx/plausible - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Logging &amp; Monitoring](/categories/logging)
4. /
5. octfx/plausible

ActiveMediawiki-extension[Logging &amp; Monitoring](/categories/logging)

octfx/plausible
===============

Integrates plausible analytics

1.4.0(2y ago)91.1k5GPL-2.0+PHPPHP &gt;=8.0CI passing

Since Jun 2Pushed 2mo ago1 watchersCompare

[ Source](https://github.com/octfx/mediawiki-extension-Plausible)[ Packagist](https://packagist.org/packages/octfx/plausible)[ Docs](https://www.mediawiki.org/wiki/Extension:Plausible)[ RSS](/packages/octfx-plausible/feed)WikiDiscussions master Synced today

READMEChangelog (2)Dependencies (6)Versions (11)Used By (0)

Plausible Analytics
===================

[](#plausible-analytics)

Plausible Analytics is a simple, lightweight (&lt; 1 KB), open-source and privacy-friendly alternative to Google Analytics. It doesn’t use cookies and is fully compliant with GDPR, CCPA and PECR.

See

Installation
------------

[](#installation)

- Download, extract and place the file(s) in a directory called Plausible in your extensions/ folder.
- Add the following code at the bottom of your LocalSettings.php file:

```
wfLoadExtension( 'Plausible' );
$wgPlausibleDomain = "https://plausible.io";
$wgPlausibleDomainKey = "mywiki.example.com"; // change to your site address
$wgPlausibleApikey = ''; // Only necessary when using Extension:PageViewInfo
```

- Configure as required.
- Done – Navigate to Special:Version on your wiki to verify that the extension is successfully installed.

Configuration
-------------

[](#configuration)

KeyDescriptionExampleDefault$wgPlausibleDomainPlausible Domain. **Required**null$wgPlausibleDomainKeyDomain Key set on the plausible website. **Required**plausible.ionull$wgPlausibleApiKeyAuth Bearer key for integration with [Extension:PageViewInfo](https://www.mediawiki.org/wiki/Extension:PageViewInfo)$wgPlausibleHonorDNTHonor the Do Not Track header and disable tracking.falsetrue$wgPlausibleTrackOutboundLinksEnable Tracking of outbound link clicks.truefalse$wgPlausibleTrackFileDownloadsEnable Tracking of link clicks that lead to files, sending a `File Download` event. See [the official docs](https://plausible.io/docs/file-downloads-tracking).truefalse$wgPlausibleTrackFileDownloadExtensionsList of additional file extensions to track. See [the official docs](https://plausible.io/docs/file-downloads-tracking#which-file-types-are-tracked).\['js', 'py'\]\[\]$wgPlausibleTrackLoggedInEnable Tracking for logged in users.truefalse$wgPlausibleEnableTaggedEventsEnable click tracking via css classes. See [the official docs](https://plausible.io/docs/custom-event-goals#2-add-a-css-class-name-to-the-element-you-want-to-track-on-your-site).truefalse$wgPlausibleIgnoredTitlesList of page titles that should not be tracked. [Examples](https://github.com/plausible/docs/blob/master/docs/excluding-pages.md#common-use-cases-and-examples).\['/Page1', '/Special:\*', \]\[\]$wgPlausibleEnableOptOutTagEnables or disables the `` tag that allows users to opt-out from being tracked.falsetrue### Included tracking scripts

[](#included-tracking-scripts)

The following tracking modules can be activated by setting the provided configuration key in `LocalSettings.php` to true.

KeyDescriptionEvent Name$wgPlausibleTrack404Sends a `404` event for unknown titles.`404`$wgPlausibleTrackSearchInputSend inputs to `#searchInput` to plausible as a custom event named `Search: Input`.`Search: Input`$wgPlausibleTrackEditButtonClicksTrack clicks to `#ca-edit a` as a custom event named `Edit Button: Click`.`Edit Button: Click`$wgPlausibleTrackNavplateClicksTrack clicks to links inside `.navplate` elements.`Navplate: Click`$wgPlausibleTrackInfoboxClicksTrack clicks to links inside `.mw-capiunto-infobox` and `.infobox` elements.`Infobox: Click`$wgPlausibleTrackCitizenSearchLinksOnly for [Skin:Citizen](https://github.com/StarCitizenTools/mediawiki-skins-Citizen). Track clicks to search result links found in `#typeahead-suggestions`. Event is named `Citizen: Search Link Click`.`Citizen: Search Link Click`$wgPlausibleTrackCitizenMenuLinksOnly for [Skin:Citizen](https://github.com/StarCitizenTools/mediawiki-skins-Citizen). Track clicks to links in the sidebar menu. Event is named `Citizen: Menu Link Click`.`Citizen: Menu Link Click`### Server Side Tracking

[](#server-side-tracking)

Some events can be sent serverside without having to rely on the included plausible client script.

The following custom events can be activated:

```
# Default Configuration
$wgPlausibleServerSideTracking = [
    // Event Name: pageview
    'pageview' => false,
    // Event Name: 404
    'page404' => false,
    // Event Name: Page: Edit
    'pageedit' => true, // Page has been successfully edited
    // Event Name: Page: Delete
    'pagedelete' => true, // Page has been deleted
    // Event Name: Page: Undelete
    'pageundelete' => true, // Page has been undeleted
    // Event Name: Page: Move
    'pagemove' => true, // Page was moved
    // Event Name: User: Register
    'userregister' => false, // A new user registered
    // Event Name: User: Login
    'userlogin' => false, // A user logged in
    // Event Name: User: Logout
    'userlogout' =>  false, // A user logged out
    // Event Name: File: Upload
    'fileupload' => true, // A file was uploaded
    // Event Name: File: Delete
    'filedelete' => true, // A file was deleted
    // Event Name: File: Undelete
    'fileundelete' => true, // A file was undeleted
    // Event Name: Search: Not found
    'searchnotfound' => true, // A searched term was not found / has no title on the wiki
    // Event Name: Search: Found
    'searchfound' => true, // A searched term was found / has a corresponding title on the wiki
];
```

### Event / Goal Names

[](#event--goal-names)

This extension chooses the following convention for naming events / goals: `Subject: Event/Action`.

Tracking Custom Events
----------------------

[](#tracking-custom-events)

If you want to track custom event goals like button clicks or form completions, you have to trigger these custom events from your website using JavaScript.

Scripts need to be placed in `MediaWiki:.js` e.g. `MediaWiki:Citizen.js`.

Example: Tracking edit button clicks on [Skin:Citizen](https://github.com/StarCitizenTools/mediawiki-skins-Citizen).

```
if (typeof window.plausible === 'undefined') {
    return;
}

document.querySelector('#ca-edit a').addEventListener('click', function (event) {
    plausible('Edit Button: Click');
});
```

### Via css classes

[](#via-css-classes)

With setting `$wgPlausibleEnableTaggedEvents = true;` click to elements can be tracked by setting css classes. From [the official docs](https://plausible.io/docs/custom-event-goals):

> You can also add class names directly in HTML If you can edit the raw HTML code of the element you want to track, you can also add the classes directly in HTML. For example:
>
> `\`
> `Click Me`
> `\`
> `Click Me`
>
> Or if your element already has a class attribute, just separate the new ones with a space:
>
> `\`
> `Click Me`
>
> `\`
> `Click Me`

> When you send custom events to Plausible, they won't show up in your dashboard automatically. You'll have to configure the goal for the conversion numbers to show up.

Ignoring Pages
--------------

[](#ignoring-pages)

By default, Plausible Analytics tracks every page you install the snippet on. If you don't want Plausible to track specific pages, do not include the snippet on those pages.

Common use cases and examples
-----------------------------

[](#common-use-cases-and-examples)

$wgPlausibleIgnoredTitles inputPrevents tracking on pages with a URL path of:`/blog4``/blog4` and exactly `/blog4` with nothing before or after it, so not `/blog45` nor `/blog4/new` nor `/blog``/rule/*``/rule/`, with `` being any set of characters (length &gt;=0), but not a forward slash - for example, both `/rule/1` as well as `/rule/general-rule-14`, but not `/rule/4/details` nor `/rules``/how-to-*``/how-to-` - for example, `/how-to-play` or `/how-to-succeed`, but not `how-to-/blog``/*/admin``//admin` - for example, `/sites/admin`, but not `/sites/admin/page-2` nor `/sites/2/admin` nor `/admin``/*/priv/*``//priv/` - for example, `/admin/priv/sites`, but not `/priv` nor `/priv/page` nor `/admin/priv``/rule/*/*``/rule//` - for example, `/rule/4/new/` or `/rule/10/edit`, but not `/rule` nor `/rule/10/new/save``/wp/**``/wp` - for example, `/wp/assets/subdirectory/another/image.png` or `/wp/admin`, and everything in between, but not `/page/wp`Lua Integration
---------------

[](#lua-integration)

With [Extension:PageViewInfo](https://www.mediawiki.org/wiki/Extension:PageViewInfo) active, plausible exposes the following functions:

1. `mw.ext.plausible.topPages()`Returns the top pages and the views for the last day. The table is ordered by the number of page views, and can be iterated by using `ipairs`.
    Example:

```
local result = mw.ext.plausible.topPages()
> {
  {
    page = "Foo",
    views = 100
  },
  {
    page = "Bar",
    views = 80
  },
  { [...] }
}
```

Alternatively this function can be called with the number of days to calculate the views over, e.g. `mw.ext.plausible.topPages( 30 )`.
This is *expensive* as no caching is employed.

2. `mw.ext.plausible.pageData( titles, days )`Returns the page views for the given titles over the last N days.
    Example:

```
local result = mw.ext.plausible.pageData( { "Foo", "Bar" }, 5 )
> {
  ["Foo"] = {
    ["2023-08-04"] = 10,
    ["2023-08-05"] = 1,
    ["2023-08-06"] = 4,
    ["2023-08-07"] = 7,
    ["2023-08-08"] = 1,
    ["2023-08-09"] = 4,
  },
  ["Bar"] = {
    ["2023-08-04"] = 100,
    ["2023-08-05"] = 14,
    ["2023-08-06"] = 54,
    ["2023-08-07"] = 7,
    ["2023-08-08"] = 31,
    ["2023-08-09"] = 1,
  },
}
```

3. `mw.ext.plausible.siteData( days )`Returns the site views for the given last N days.
    Example:

```
local result = mw.ext.plausible.siteData( 5 )
> {
  ["2023-08-04"] = 10,
  ["2023-08-05"] = 1,
  ["2023-08-06"] = 4,
  ["2023-08-07"] = 7,
  ["2023-08-08"] = 1,
  ["2023-08-09"] = 4,
}
```

###  Health Score

43

—

FairBetter than 89% of packages

Maintenance58

Moderate activity, may be stable

Popularity27

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 82.5% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~115 days

Recently: every ~31 days

Total

9

Last Release

933d ago

PHP version history (2 changes)1.0.0PHP &gt;=7.2

1.4.0PHP &gt;=8.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/6594492?v=4)[H. C. Kruse](/maintainers/Octfx)[@octfx](https://github.com/octfx)

---

Top Contributors

[![octfx](https://avatars.githubusercontent.com/u/6594492?v=4)](https://github.com/octfx "octfx (99 commits)")[![translatewiki](https://avatars.githubusercontent.com/u/24829418?v=4)](https://github.com/translatewiki "translatewiki (18 commits)")[![alistair3149](https://avatars.githubusercontent.com/u/9260542?v=4)](https://github.com/alistair3149 "alistair3149 (3 commits)")

---

Tags

mediawiki-extensionplausible-analytics

### Embed Badge

![Health badge](/badges/octfx-plausible/health.svg)

```
[![Health](https://phpackages.com/badges/octfx-plausible/health.svg)](https://phpackages.com/packages/octfx-plausible)
```

###  Alternatives

[helsingborg-stad/municipio

A bootstrap theme for creating municipality sites.

4028.5k10](/packages/helsingborg-stad-municipio)[stayallive/wp-sentry

A (unofficial) WordPress plugin to report PHP and JavaScript errors to Sentry.

385220.1k](/packages/stayallive-wp-sentry)[october/rain

October Rain Library

1601.7M83](/packages/october-rain)[pressbooks/pressbooks

Pressbooks is an open source book publishing tool built on a WordPress multisite platform. Pressbooks outputs books in multiple formats, including PDF, EPUB, web, and a variety of XML flavours, using a theming/templating system, driven by CSS.

45444.2k1](/packages/pressbooks-pressbooks)[mediawiki/maps

Adds various mapping features to MediaWiki

84152.3k3](/packages/mediawiki-maps)[humanmade/aws-xray

HM Platform AWS X-Ray Integration

29246.8k8](/packages/humanmade-aws-xray)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
