PhoenixKitWebAnalytics.Paths (PhoenixKitWebAnalytics v0.2.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.

Pages report — every path, ranked.

A pages-report URL carrying report filters.

The tracking-pixel endpoint (GET), optionally with a cache-busting value.

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.

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)

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

The tracking-pixel endpoint (GET), optionally with a cache-busting value.

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.