URL Events

Transforms raw URL values into structured event names based on a configurable URL path tree. Useful when your event column contains page URLs and you want to group or simplify them into meaningful event names.

Usage

es.url_events(
    column="event",
    nodes=[
        {"path": "/product", "is_cut": True},
        {"path": "/checkout"},
        {"path": "/admin", "is_deleted": True},
    ],
    strip_host=True,
    strip_cgi=True,
)

Parameters

ParameterTypeDefaultDescription
columnstrrequiredThe column containing raw URL values.
nodeslist[dict]requiredURL tree nodes. Each dict must have path. See node options below.
strip_hostboolTrueRemove scheme and hostname, keeping only the path.
strip_cgiboolTrueRemove query string and URL fragment.
strip_localeboolTrueRemove 2-letter locale prefix from the first path segment (e.g. /en/product/product).
host_colstr | NoneNoneIf provided, write the extracted hostname into this new column.
cgi_colstr | NoneNoneIf provided, write the extracted query string into this new column.
locale_colstr | NoneNoneIf provided, write the extracted locale code into this new column.

Node options

KeyTypeDescription
pathstrURL path prefix to match.
is_cutboolCollapse all sub-paths under this node into a single event, appending a slug for the remaining path segment.
is_deletedboolRemove all events matching this path prefix.
custom_namestrCustom label used as the event name instead of the raw path.