PhoenixKitWebAnalytics.Paths (PhoenixKitWebAnalytics v0.5.0)

Copy Markdown View Source

Centralized path helpers for the Web Analytics module.

Every link, redirect, and beacon URL goes through PhoenixKit.Utils.Routes.path/1 so the host's PhoenixKit URL prefix and locale are applied. Never hardcode these paths — a host that mounts PhoenixKit at /backend instead of /admin would break every one of them.

Summary

Functions

The beacon endpoint that accepts custom events (POST).

Overview dashboard — totals, trend, and the top breakdowns.

A dashboard URL carrying report filters as query parameters.

Custom events report and the live hit feed.

Who is on the site right now.

Pages report — every path, ranked.

A pages-report URL carrying report filters.

The tracking-pixel endpoint (GET) for the page at path, optionally with a cache-busting value.

One session's timeline — everything the visitor did, in order.

Sessions — every visit, with where it started and ended.

Sessions filtered to one logged-in user.

Settings page for the module.

Acquisition report — referrers, sources, and UTM campaigns.

Technology report — browsers, operating systems, devices, countries.

Functions

beacon_endpoint()

@spec beacon_endpoint() :: String.t()

The beacon endpoint that accepts custom events (POST).

dashboard()

@spec dashboard() :: String.t()

Overview dashboard — totals, trend, and the top breakdowns.

dashboard(params)

@spec dashboard(map()) :: String.t()

A dashboard URL carrying report filters as query parameters.

iex> is_binary(PhoenixKitWebAnalytics.Paths.dashboard(%{"period" => "7d"}))
true

events()

@spec events() :: String.t()

Custom events report and the live hit feed.

live()

@spec live() :: String.t()

Who is on the site right now.

pages()

@spec pages() :: String.t()

Pages report — every path, ranked.

pages(params)

@spec pages(map()) :: String.t()

A pages-report URL carrying report filters.

pixel_endpoint(cache_buster \\ nil, path \\ nil)

@spec pixel_endpoint(String.t() | nil, String.t() | nil) :: String.t()

The tracking-pixel endpoint (GET) for the page at path, optionally with a cache-busting value.

session(session_id)

@spec session(String.t()) :: String.t()

One session's timeline — everything the visitor did, in order.

sessions()

@spec sessions() :: String.t()

Sessions — every visit, with where it started and ended.

sessions_for_user(user_uuid)

@spec sessions_for_user(String.t()) :: String.t()

Sessions filtered to one logged-in user.

settings()

@spec settings() :: String.t()

Settings page for the module.

sources()

@spec sources() :: String.t()

Acquisition report — referrers, sources, and UTM campaigns.

technology()

@spec technology() :: String.t()

Technology report — browsers, operating systems, devices, countries.