URL Normalization

URL Normalization

Normalizes URLs by replacing dynamic path segments (containing numbers or capital letters) with :id placeholders. This helps group similar URLs together for analysis.

Configuration

OptionDescription
Remove hash parameter
Type: boolean
Required: False

Whether to remove the hash parameter in the normalized URL

Remove query string
Type: boolean
Required: False

Whether to remove the query string in the normalized URL

Replace with token
Type: string
Required: False

The string to replace parts that look like a dynamic path segment. Defaults to :id

URL properties to normalize
Type: string
Required: True

Comma-separated list of event properties to normalize. Can include both event properties and top-level event fields like distinct_id.

Regex
Type: string
Required: False

The regex to use to match the dynamic path segment. The default value will match UUIDs and strings of 3 or more capital letters or numbers.

Using our REST API you can create this transformation like so:

Terminal
# Create a new destination
curl --location 'https://us.i.posthog.com/api/environments/:project_id/hog_functions' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <POSTHOG_PERSONAL_API_KEY>' \
--data '{
"type": "transformation",
"name": "URL Normalization",
"inputs": {
"urlProperties": {
"value": ""
}
},
"enabled": true,
"template_id": "template-url-normalization"
}'