View Source Plausible.Stats.Util (Plausible v0.0.1)

Utilities for modifying stat results

Summary

Functions

Returns the common currency for the goal filters in a query. If there are no goal filters, multiple currencies or the site owner does not have access to revenue goals, nil is returned and revenue metrics are dropped.

__internal_visits is fetched when querying bounce rate and visit duration, as it is needed to calculate these from imported data. This function removes that metric from all entries in the results list.

Functions

Link to this function

cast_revenue_metrics_to_money(results, revenue_goals)

View Source
Link to this function

get_revenue_tracking_currency(site, query, metrics)

View Source
@spec get_revenue_tracking_currency(Plausible.Site.t(), Plausible.Stats.Query.t(), [
  atom()
]) ::
  {atom() | nil, [atom()]}

Returns the common currency for the goal filters in a query. If there are no goal filters, multiple currencies or the site owner does not have access to revenue goals, nil is returned and revenue metrics are dropped.

Aggregating revenue data works only for same currency goals. If the query is filtered by goals with different currencies, for example, one USD and other EUR, revenue metrics are dropped.

Link to this function

remove_internal_visits_metric(result)

View Source
Link to this function

remove_internal_visits_metric(results, metrics)

View Source

__internal_visits is fetched when querying bounce rate and visit duration, as it is needed to calculate these from imported data. This function removes that metric from all entries in the results list.