View Source Plausible.Goals (Plausible v0.0.1)

Summary

Functions

Creates a Goal for a site.

If a goal belongs to funnel(s), we need to inspect their number of steps.

Functions

@spec count(Plausible.Site.t()) :: non_neg_integer()
Link to this function

create(site, params, opts \\ [])

View Source
@spec create(Plausible.Site.t(), map(), Keyword.t()) ::
  {:ok, Plausible.Goal.t()}
  | {:error, Ecto.Changeset.t()}
  | {:error, :upgrade_required}

Creates a Goal for a site.

If the created goal is a revenue goal, it sets site.updated_at to be refreshed by the sites cache, as revenue goals are used during ingestion.

If a goal belongs to funnel(s), we need to inspect their number of steps.

If it exceeds the minimum allowed (defined via Plausible.Funnel.min_steps/0), the funnel will be reduced (i.e. a step associated with the goal to be deleted is removed), so that the minimum number of steps is preserved. This is done implicitly, by postgres, as per on_delete: :delete_all.

Otherwise, for associated funnel(s) consisting of minimum number steps only, funnel record(s) are removed completely along with the targeted goal.

Link to this function

find_or_create(site, map)

View Source
Link to this function

for_site(site, opts \\ [])

View Source
Link to this function

for_site_query(site, opts \\ [])

View Source