URL normalization helpers for analytics grouping.
Single source of truth for host and path values written to ga_events.
Raw URLs stay on ga_events.url; these helpers produce the normalized
host and path columns used for indexed analytics queries.
Summary
Functions
Returns the normalized host from a URL.
Returns the normalized path from a URL.
Returns a stable grouping key made from scheme, host, and normalized path.
Functions
Returns the normalized host from a URL.
Lowercase, default ports stripped (80 for http, 443 for https).
Returns nil when no host is present.
Returns the normalized path from a URL.
Defaults to /, query/fragment stripped, duplicate slashes collapsed,
trailing slash trimmed except for root.
Returns a stable grouping key made from scheme, host, and normalized path.
Query strings and fragments are removed. Duplicate slashes in the path are collapsed, and a trailing slash is stripped except for the root path.