View Source API Reference Plausible v0.0.1

Modules

Plausible keeps the contexts that define your domain and business logic.

Clickhouse access with async inserts enabled

This embedded schema stores information about the account locking grace period.

This module provides functions to work with plans usage and limits.

The subscription statuses are stored in Paddle. They can only be changed through Paddle webhooks, which always send the current subscription status via the payload.

Helper function for working with Ecto changesets

Provides the core functions to retrieve and manage the CLDR data that supports formatting and localisation.

Parses HTTP Accept-Language header values as defined in rfc2616.

Backend module that provides functions to define new locales and display human-readable locale names for presentation purposes.

Formats numbers and currencies based upon CLDR's decimal formats specification.

Implements cardinal plural rules for numbers.

Functions to manage the collection of number patterns defined in Cldr.

Implements ordinal plural rules for numbers.

Implements plural rules for ranges

Transliteration for digits and separators.

Functions to implement the number system rule-based-number-format rules of CLDR.

Functions to implement the ordinal rule-based-number-format rules of CLDR.

Functions to implement the spellout rule-based-number-format rules of CLDR.

Event schema for when NumericIDs migration is complete

Session schema for when NumericIDs migration is complete

Custom type to cast Bool as UInt8

This module defines the setup for tests requiring access to the application's data layer.

Base module for coordinated Clickhouse data migrations run via remote shell or otherwise (TBD).

Numeric IDs migration, SQL files available at: priv/data_migrations/NumericIDs/sql

Ecto.Repo for Clickhouse data migrations, to be started manually, outside of the main application supervision tree.

A data fix migration that seeks funnels having steps whose goals are equally named. It then tries to rewrite the duplicate goals using the oldest goal available. In extreme cases, e.g. when multiple duplicates are found for a single funnel, it will either reduce or completely remove the funnel. This enables us to run a migration later on that will delete duplicate goals and enforce goal uniqueness at the database level via a CHECK constraint.

Function execution context (with arguments) to Sentry reports.

Custom type for event name. Accepts Strings and Integers and stores them as String. Returns cast error if any other type is provided. Accepting integers is important for 404 tracking.

A funnel is a marketing term used to capture and describe the journey that users go through, from initial step to conversion. A funnel consists of several steps (here: 2..8).

This module defines the database schema for a single Funnel step. See: Plausible.Funnel for more information.

This module implements contextual Funnel interface, allowing listing, creating and deleting funnel definitions.

This module provides an API for fetching IP geolocation.

This GenServer inserts records into Clickhouse imported_* tables. Multiple buffers are automatically created for each table. Records are flushed when the table buffer reaches the maximum size, defined by max_buffer_size/0.

HTTP Client built on top of Finch.

A dedicated repo for import related mutations

Write-centric Clickhouse access interface

This is instrumentation necessary for keeping track of per-domain internal metrics. Due to metric labels cardinality (domain x metric_name), these statistics are not suitable for prometheus/grafana exposure, hence an internal storage is used.

A buffer aggregating counters for internal metrics, within 10 seconds time buckets.

Clickhouse schema for storing ingest counter metrics

Susbcribes to telemetry events emitted by Plausible.Ingestion.Event. Every time a request derived event is either dispatched to clickhouse or dropped, a telemetry event is emitted respectively. That event is captured here, its metadata is extracted and sent for internal stats aggregation via Counters.Buffer interface.

This module exposes the build_and_buffer/1 function capable of turning %Plausible.Ingestion.Request{} into a series of events that in turn are uniformly either buffered in batches (to Clickhouse) or dropped (e.g. due to spam blocklist) from the processing pipeline.

The %Plausible.Ingestion.Request{} struct stores all needed fields to create an event downstream. Pre-eliminary validation is made to detect user errors early.

Custom OpenTelemetry sampler implementation that ignores particular traces to reduce noise. Ingestion HTTP requests and queries to Oban tables are ignored, for example.

Plugins API Context module for Shared Links. All high level Shared Links operations should be implemented here.

Cursor-based pagination for the Plugins API. Can be moved to another namespace in case used elsewhere.

Ecto schema for Plugins API Tokens. Tokens are stored hashed and require a description.

Context module for Plugins API Tokens. Exposes high-level operation for token-based authentication flows.

Custom PromEx plugin for instrumenting code within Plausible app.

Context module for handling custom event props.

Deletes data from a site.

Sentry callbacks for filtering and grouping events

Site schema

A "sites by domain" caching interface.

A periodic cache warmer. Queries all Sites from Postgres, every interval and pre-populates the cache. After each run the process is hibernated, triggering garbage collection.

A Cache.Warmer adapter that refreshes the Sites Cache fully. This module exists only to make it explicit what the warmer refreshes, to be used in the supervisor tree.

A Cache.Warmer adapter that only refreshes the Cache with recently updated sites every 30 seconds.

Basic interface for domain changes.

Thin wrapper around Hammer for gate keeping domain-specific events during the ingestion phase. When the site is allowed, gate keeping check returns :allow, otherwise a :deny tagged tuple is returned with one of the following policy markers

Embedded schema for Google Analytics imports

API for site memberships and invitations

Service for accepting invitations, including ownership transfers.

Service for rejecting invitations.

Service for removing invitations.

A site deletion service stub.

This module provides functions for comparing query periods.

Module for querying user defined 'custom properties'.

A module for parsing filters used in stat queries.

Module responsible for funnel evaluation, i.e. building and executing ClickHouse funnel query based on Plausible.Funnel definition.

Collection of functions to work with intervals.

Utilities for modifying stat results

Floki wrappers to help make assertions about HTML/DOM structures

User context

Periodic worker that expires domain change transition period. Old domains are frozen for a given time, so users can still access them before redeploying their scripts and integrations.

Generic reusable components

Phoenix Component for rendering a user-facing feature toggle capable of flipping booleans in Plausible.Site via the toggle_feature controller action.

This module defines the test case to be used by tests that require setting up a connection.

A Plug that fetches favicon images from DuckDuckGo and returns them to the Plausible frontend.

Redirects first-launch users to registration page.

LiveView for upgrading to a plan, or changing an existing plan.

Phoenix LiveComponent for a combobox UI element with search and selection functionality.

Default suggestion engine for the ComboBox component.

Generic components stolen from mix phx.new templates

Flash component for LiveViews - works also when embedded within dead views

LiveView allowing listing, creating and deleting funnels.

Phoenix LiveComponent that renders a form used for setting up funnels. Makes use of dynamically placed PlausibleWeb.Live.FunnelSettings.ComboBox components to allow building searchable funnel definitions out of list of goals available.

Phoenix LiveComponent module that renders a list of funnels with their names and the number of steps they have.

LiveView allowing listing, creating and deleting goals.

Live view for the goal creation form

Phoenix LiveComponent module that renders a list of goals

LiveView allowing listing, allowing and disallowing custom event properties.

Live view for the custom props creation form

Phoenix LiveComponent module that renders a list of custom properties

LiveView for registration form.

LiveView for password reset form.

MJML rendered for the weekly report e-mail

Plausible Plugins API

Controller for the Shared Link resource under Plugins API

Common responses for Plugins API

OpenAPI schema for an error included in a response

OpenAPI schema for a generic 404 response

Pagination metadata OpenAPI schema

OpenAPI schema for SharedLink object

OpenAPI schema for SharedLink creation request

OpenAPI schema for SharedLink list response

OpenAPI schema for a generic 401 response

OpenAPI schema for a generic 422 response

OpenAPI specification for the Plugins API

View for rendering Plugins REST API errors

A view capable of rendering pagination metadata included in responses containing lists of objects.

View for rendering Shared Links in the Plugins API

This module defines the test case to be used by tests that require setting up a Plugins API connection.

Plug for Basic HTTP Authentication using Plugins API Tokens lookup.

Plug toggling registration according to selfhosted state.

Rejects bot requests by any means available.

A Plug.Session adapter that allows configuration at runtime. Sadly, the plug being wrapped has no MFA option for dynamic configuration.

This controller deals with user management via the UI in Site Settings -> People. It's important to enforce permissions in this controller.

This controller is responsible for rendering stats dashboards.

Mix Tasks

This task is meant to replicate the behavior of cancelling a subscription. On production, this action is initiated by a Paddle webhook. Currently, only the subscription status is changed with that action.

This task downloads the Country Lite database from DB-IP for self-hosted or development purposes. Plausible Cloud runs a paid version of DB-IP with more detailed geolocation data.

It's often necessary to generate fake events for development and testing purposes. This Mix Task provides a quick and easy way to generate a pageview or custom event, either in your development environment or a remote Plausible instance.