View Source Plausible.Billing.Quota (Plausible v0.0.1)

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

Summary

Functions

Returns a list of features the user can use. Trial users have the ability to use all features during their trial.

Returns whether the usage is below the limit or not. Returns false if usage is equal to the limit.

Given a user, this function returns the features used across all the sites this user owns + StatsAPI if the user has a configured Stats API key.

Returns the limit of pageviews for a subscription.

Returns the amount of pageviews and custom events sent by the sites the user owns in last 30 days.

Returns the limit of sites a user can have.

Returns the number of sites the given user owns.

Returns the limit of team members a user can have in their sites.

Returns the total count of team members and pending invitations associated with the user's sites.

Returns whether the usage is within the limit or not. Returns true if usage is equal to the limit.

Functions

Link to this function

allowed_features_for(user)

View Source

Returns a list of features the user can use. Trial users have the ability to use all features during their trial.

Link to this function

below_limit?(usage, limit)

View Source
@spec below_limit?(non_neg_integer(), non_neg_integer() | :unlimited) :: boolean()

Returns whether the usage is below the limit or not. Returns false if usage is equal to the limit.

Link to this function

ensure_can_subscribe_to_plan(user, plan)

View Source
Link to this function

exceeded_limits(usage, plan)

View Source
@spec features_usage(Plausible.Auth.User.t() | Plausible.Site.t()) :: [atom()]

Given a user, this function returns the features used across all the sites this user owns + StatsAPI if the user has a configured Stats API key.

Given a site, returns the features used by the site.

Link to this function

monthly_pageview_limit(subscription)

View Source
@spec monthly_pageview_limit(Plausible.Billing.Subscription.t()) ::
  non_neg_integer() | :unlimited

Returns the limit of pageviews for a subscription.

Link to this function

monthly_pageview_usage(user)

View Source
@spec monthly_pageview_usage(Plausible.Auth.User.t()) :: non_neg_integer()

Returns the amount of pageviews and custom events sent by the sites the user owns in last 30 days.

@spec site_limit(Plausible.Auth.User.t()) :: non_neg_integer() | :unlimited

Returns the limit of sites a user can have.

For enterprise customers, returns :unlimited. The site limit is checked in a background job so as to avoid service disruption.

@spec site_usage(Plausible.Auth.User.t()) :: non_neg_integer()

Returns the number of sites the given user owns.

@spec team_member_limit(Plausible.Auth.User.t()) :: non_neg_integer()

Returns the limit of team members a user can have in their sites.

@spec team_member_usage(Plausible.Auth.User.t()) :: integer()

Returns the total count of team members and pending invitations associated with the user's sites.

Link to this function

within_limit?(usage, limit)

View Source
@spec within_limit?(non_neg_integer(), non_neg_integer() | :unlimited) :: boolean()

Returns whether the usage is within the limit or not. Returns true if usage is equal to the limit.