View Source API Reference Plausible v0.0.1
Modules
Build-related macros
Clickhouse access with async inserts enabled
Schema for email activation codes.
API for verifying emails.
This embedded schema stores information about the account locking grace period.
TOTP auth context
Defines an Ecto type so Cloak.Ecto can encrypt/decrypt a binary field.
Schema for TOTP recovery codes.
Provides a vault that will be used to encrypt/decrypt the TOTP secrets of users who enable it.
Ecto type representing a feature. Features are cast and stored in the
database as strings and loaded as modules, for example: "props"
is loaded
as Plausible.Billing.Feature.Props
.
Ecto type representing a list of features. This is a proxy for
{:array, Plausible.Billing.Ecto.Feature}
and is required for Kaffy to
render the HTML input correctly.
Ecto type representing a limit, that can be either a number or unlimited.
Unlimited is dumped to the database as -1
and loaded as :unlimited
to
keep compatibility with the rest of the codebase.
This module provides an interface for managing features, e.g. Revenue Goals, Funnels and Custom Properties.
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.
Caching interface specific for Plausible. Usage
A periodic cache warmer.
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.
Sessions CollapsingMergeTree -> VersionedCollapsingMergeTree migration, SQL files available at: priv/data_migrations/VersionedSessions/sql
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).
Compile-time convience constants for funnel characteristics.
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.
Currency specific functions for revenue goals
HTTP Client built on top of Finch.
Common helpers for JSON handling
A dedicated repo for import related mutations
Context for managing site statistics imports.
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
.
CSV importer stub.
Definitions of import sources.
Behaviour that should be implemented for each import source.
Stub import implementation.
Site import schema.
Import implementation for Universal Analytics.
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
Subscribes 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.
Revenue specific functions for the ingestion scope
The %Plausible.Ingestion.Request{} struct stores all needed fields to create an event downstream. Pre-eliminary validation is made to detect user errors early.
Revenue specific functions for the ingestion scope
This module ensures that you cannot run Plausible Analytics Enterprise Edition without a valid license key. The software contained within the ee/ and assets/js/dashboard/ee directories are Copyright © Plausible Insights OÜ. We have made this code available solely for informational and transparency purposes. No rights are granted to use, distribute, or exploit this software in any form.
Base module for to use in Clickhouse migrations
Custom OpenTelemetry sampler implementation that ignores particular traces to reduce noise. Ingestion HTTP requests and queries to Oban tables are ignored, for example.
Cursor-based pagination.
Context module for querying API capabilities
Plugins API context module for Custom Props. All high level Custom Props operations should be implemented here.
Plugins API context module for Goals. All high level Goal operations should be implemented here.
Plugins API context module for Shared Links. All high level Shared Links operations should be implemented here.
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.
Thin wrapper around :ets.update_counter/4
and a
clean-up process to act as a rate limiter.
Sentry callbacks for filtering and grouping events
Schema for IP block list
Allows retrieving IP Rules by domain and IP
Contextual interface for shields.
Site schema
The cache allows lookups by both domain
and domain_changed_from
fields - this is to allow traffic from sites whose domains changed within a certain
grace period (see: Plausible.Site.Transfer
).
Basic interface for domain changes.
Thin wrapper around Plausible.RateLimit
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 analytics imports
API for site memberships and invitations
Service for accepting invitations, including ownership transfers.
Service for inviting new or existing users to a sites, including ownershhip transfers.
Service for rejecting invitations.
Service for removing invitations.
A site deletion service stub.
User-specific site preferences schema
Sites context functions.
This module provides functions for comparing query periods.
Module for querying user defined 'custom properties'.
This module exposes a get/2
function that returns a map
of stats needed for email reports. These stats include
A module for parsing filters used in stat queries.
Contains utility functions shared between DashboardFilterParser
and StatsAPIFilterParser
.
Module responsible for funnel evaluation, i.e. building and executing
ClickHouse funnel query based on Plausible.Funnel
definition.
Revenue specific functions for the stats scope
Collection of functions to work with intervals.
Sampling related functions
Utilities for modifying stat results
Floki wrappers to help make assertions about HTML/DOM structures
Currently only supports post request, it's a drop-in replacement for our exvcr usage that wasn't ever needed (e.g. we had no way to re-record the cassettes anyway).
User context
A worker meant to be run once a day that sends out e-mail notifications to site owners assuming
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.
Worker for running analytics import jobs.
This module proxies requests to BASE_URL/avatar/:hash to www.gravatar.com/avatar/:hash.
This module exposes functions for rendering and returning plan benefits for Growth, Business, and Enterprise plans.
Generic reusable components
Google-related components
An umbrella module for the Integrations settings section
Phoenix Component for rendering a user-facing feature toggle
capable of flipping booleans in Plausible.Site
via the toggle_feature
controller action.
Reusable components specific to 2FA
This module defines the test case to be used by tests that require setting up a connection.
Revenue specific functions for the API scope
Plausible tracking itself functions
A Plug that fetches favicon images from DuckDuckGo and returns them to the Plausible frontend.
Redirects first-launch users to registration page.
Test helper for setup blocks allowing to skip the plug processing
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
LiveView implementation of modal component.
Pagination components for LiveViews.
Component rendering mini-graph of site's visitors over the last 24 hours.
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, creating and revoking Plugins API tokens.
Live view for the goal creation form
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.
This module tries to supply LiveViews with some common Sentry context (without it, there is practically none).
LiveView allowing IP Rules management
Currently only a placeholder module. Once more shields are implemented it will display tabs with counters, linking to their respective live views.
LiveView for sites index.
MJML rendered for the weekly or monthly report e-mail
Controller for Plugins API Capabilities - doesn't enforce authentication, serves as a comprehensive health check
Controller for the CustomProp resource under Plugins API
Controller for the Goal resource under Plugins API
Controller for the Shared Link resource under Plugins API
Common responses for Plugins API
OpenAPI schema for Capabilities
OpenAPI schema for Goal
OpenAPI schema for Custom Property disable request
OpenAPI schema for Custom Property creation request
OpenAPI schema for SharedLink list response
OpenAPI schema for an error included in a response
OpenAPI schema for Goal
OpenAPI schema for Goal creation request
OpenAPI schema for Custom Event Goal creation request
OpenAPI schema for Pageview Goal creation request
OpenAPI schema for Custom Event Goal creation request
OpenAPI schema for Custom Event Goal object
OpenAPI schema for bulk Goal deletion request
OpenAPI schema for Goals list response
OpenAPI schema for Pageview Goal object
OpenAPI schema for Revenue Goal object
OpenAPI schema for common Goal Type
OpenAPI Link schema
OpenAPI schema for a generic 404 response
Pagination metadata OpenAPI schema
OpenAPI schema for a generic 402 response
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 Capabilities on the Plugins API
View for rendering Custom Props in the Plugins API
View for rendering Plugins REST API errors
View for rendering Goals in the Plugins API
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.
A thin macro wrapper around Plug.ErrorHandler that adds Sentry context containing a readable support hash presented to the users. To be used in the user-facing APIs, so that we don't leak internal server errors.
Plug toggling registration according to selfhosted state.
Rejects bot requests by any means available.
Implements the strategy of retrieving client's remote IP
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.
Functions for managing session data related to Two-Factor Authentication.
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.