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
| Parameter | Type | Description |
|---|---|---|
column | str | Name of the column that contains raw URL strings. |
nodes | list of dict | URL path tree. Each node dict must have a "path" key (str) and may include: |
strip_host | bool, default True`` | Remove the scheme and hostname, keeping only the pathname. |
strip_query | bool, default True`` | Remove the query string and URL fragment. |
strip_locale | bool, default True`` | Remove a leading 2-letter BCP-47 locale segment (e.g. "en", "fr-ca"). |
keep_full_paths | bool, default False`` | When True, aggregate_children nodes are ignored and every URL keeps its normalized path. |
host_col | str, optional | If provided, save the extracted hostname into this new column. |
query_col | str, optional | If provided, save the extracted query string into this new column. |
locale_col | str, optional | If provided, save the detected locale prefix into this new column. |
slug_col | str, optional | If provided, save the sub-page slug into this new column. |