View Source Plausible.Stats.Filters.Utils (Plausible v0.0.1)

Contains utility functions shared between DashboardFilterParser and StatsAPIFilterParser.

Summary

Functions

Does the opposite to wrap_goal_value, turning the {:page, path} and {:event, name} tuples into strings. Similarly, when given a list, maps all the list elements into strings with the same logic.

Wraps the given goal filter into a tuple where the first element represents the goal type (i.e. page or event), and the second element is either the page path or the event name.

Functions

Link to this function

list_expression?(expression)

View Source
Link to this function

parse_member_list(raw_value)

View Source
Link to this function

remove_escape_chars(value)

View Source
Link to this function

unwrap_goal_value(goals)

View Source

Does the opposite to wrap_goal_value, turning the {:page, path} and {:event, name} tuples into strings. Similarly, when given a list, maps all the list elements into strings with the same logic.

Examples

iex> Plausible.Stats.Filters.Utils.unwrap_goal_value({:page, "/register"}) "Visit /register"

iex> Plausible.Stats.Filters.Utils.unwrap_goal_value({:event, "Signup"}) "Signup"

iex> Plausible.Stats.Filters.Utils.unwrap_goal_value([{:event, "Signup"}, {:page, "/register"}]) ["Signup", "Visit /register"]

Link to this function

wildcard_expression?(expression)

View Source

Wraps the given goal filter into a tuple where the first element represents the goal type (i.e. page or event), and the second element is either the page path or the event name.

Given a list of goal filter values, wraps all values based on the same logic.

Examples

iex> Plausible.Stats.Filters.Utils.wrap_goal_value("Visit /register")

iex> Plausible.Stats.Filters.Utils.wrap_goal_value("Signup")

iex> Plausible.Stats.Filters.Utils.wrap_goal_value(["Signup", "Visit /register"]) [{:event, "Signup"}, {:page, "/register"}]