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
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"]
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"}]