> ## Documentation Index
> Fetch the complete documentation index at: https://confidence.spotify.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Route Parameterization

> Group recording routes that contain dynamic identifiers.

## Default Behavior

Route parameterization replaces dynamic path segments with stable placeholders. It
groups route filters and page-level insights by page type instead of by individual
page visit.

The SDK applies a built-in parameterizer when you do not supply one.

| Path segment                                 | Replacement | Example                                        |
| -------------------------------------------- | ----------- | ---------------------------------------------- |
| Universally unique identifier (UUID)         | `:uuid`     | `/orders/550e8400-e29b-41d4-a716-446655440000` |
| Numeric identifier                           | `:id`       | `/users/123`                                   |
| 20-character AIP-122 identifier              | `:id`       | `/projects/a1b2c3d4e5f6g7h8i9j0`               |
| Segment containing 20 hexadecimal characters | `:id`       | `/documents/507f1f77bcf86cd799439011`          |

For example:

```text theme={null}
/users/123/orders/550e8400-e29b-41d4-a716-446655440000
```

becomes:

```text theme={null}
/users/:id/orders/:uuid
```

Static path segments remain unchanged.

## Add Application Patterns

The `parameterizeRoute` option replaces the built-in function. Call
`defaultParameterizeRoute()` inside your function to keep the default behavior:

Install the recorder package to import the built-in helper directly:

```bash theme={null}
npm install @spotify-confidence/csr-recorder
```

```typescript theme={null}
import { defaultParameterizeRoute } from '@spotify-confidence/csr-recorder';
import { initSessionRecorder } from '@spotify-confidence/session-recording';

const recorder = initSessionRecorder({
  clientSecret: '<your-client-secret>',
  parameterizeRoute: route => {
    return defaultParameterizeRoute(route).replace(
      /\/teams\/[^/]+/,
      '/teams/:slug',
    );
  },
});
```

This example converts `/teams/acme-inc/projects/123` to
`/teams/:slug/projects/:id`.

## Design Stable Patterns

* Return the same value for routes that represent the same page type.
* Preserve enough static text to distinguish different page types.
* Keep the leading slash.
* Avoid placeholders that contain user or resource values.
* Test routes with several identifier formats before deployment.

Changing a pattern changes the grouping of new page-level metrics. Existing
recordings keep the route values captured by their SDK version.

## URL Privacy

Route parameterization changes path segments in route-change and initial page events.
It does not remove query strings or fragments from the initial page URL. It also does
not change network request URLs.

Do not place personal data, secrets, or access tokens in URLs. Configure
[privacy and data masking](/docs/recordings/privacy) separately.

## Related Resources

<CardGroup cols={2}>
  <Card title="Get started" href="/docs/recordings/getting-started">
    Configure the Recording SDK.
  </Card>

  <Card title="Explore recordings" href="/docs/recordings/explore-recordings">
    Review route journeys and page-level insights.
  </Card>
</CardGroup>
