URLs to Events

Turn a raw URL column into structured event names using a URL path tree.

Each URL is matched against the nodes tree. A node with aggregate_children set becomes an aggregation point: the node's own URL keeps its path as the event name, while deeper pages are collapsed into a <path>/<slug> label. The original URL column is replaced in-place.

Usage

stream.urls_to_events(
    column="page",
    nodes=[
        {"path": "/catalog", "aggregate_children": True},
        {"path": "/checkout", "aggregate_children": True, "name": "checkout"},
    ],
)

Parameters

ParameterTypeDescription
columnstrName of the column that contains raw URL strings.
nodeslist of dictURL path tree. Each node dict must have a "path" key (str) and may include:
strip_hostbool, default True``Remove the scheme and hostname, keeping only the pathname.
strip_querybool, default True``Remove the query string and URL fragment.
strip_localebool, default True``Remove a leading 2-letter BCP-47 locale segment (e.g. "en", "fr-ca").
keep_full_pathsbool, default False``When True, aggregate_children nodes are ignored and every URL keeps its normalized path.
host_colstr, optionalIf provided, save the extracted hostname into this new column.
query_colstr, optionalIf provided, save the extracted query string into this new column.
locale_colstr, optionalIf provided, save the detected locale prefix into this new column.
slug_colstr, optionalIf provided, save the sub-page slug into this new column.