Firebase Summit is happening now. Tune in to learn how Firebase can help you accelerate app development, gain actionable insights and scale with ease. Join now

Create custom URL patterns

Firebase Performance Monitoring automatically aggregates data for similar network requests to help you understand trends in your network request performance.

For each request, Firebase checks if the network request's URL matches a URL pattern. If the request URL matches a URL pattern, Firebase automatically aggregates the request's data under the URL pattern. Firebase displays URL patterns and their aggregated data in the Network tab in Performance dashboard of the Firebase console.

You can create custom URL patterns to monitor specific URL patterns that Firebase isn't capturing with its derived automatic URL pattern matching. For example, you can use a custom URL pattern to troubleshoot a specific URL or to monitor a specific set of URLs over time.

How does custom URL pattern matching work?

Firebase attempts to match request URLs to any configured custom URL patterns before falling back to automatic URL pattern matching. For any matching requests to a custom URL pattern, Firebase aggregates the requests' data under the custom URL pattern.

If a request's URL matches more than one custom URL pattern, Firebase maps the request to the most specific custom URL pattern only, according to the following specificity order: plain text > * > ** from left to right in the path. For example, a request to example.com/books/dog matches two custom URL patterns:

  • example.com/books/*
  • example.com/*/dog

However, the pattern example.com/books/* is the most specific matching URL pattern because the leftmost segment books in example.com/books/* takes precedence over the leftmost segment * in example.com/*/dog.

When you create a new custom URL pattern, be aware of the following:

  • Matches and aggregated data from previous requests aren't affected by creating a new custom URL pattern. Firebase does not retroactively re-aggregate request data.

  • Only future requests are affected by creating a new custom URL pattern. You might need to wait up to 12 hours for Performance Monitoring to collect and aggregate data under a new custom URL pattern.

Create a custom URL pattern

Create a custom URL pattern from the Performance dashboard of the console in the Network tab. A project member must be an Owner or Editor to create a new custom URL pattern; however, all project members can view custom URL patterns and their aggregated data.

You can create up to 400 total custom URL patterns per app and up to 100 custom URL patterns per domain for that app.

To create a custom URL pattern, start with a domain, then use the following path segment syntax to create a pattern that can match URL paths.

  • plain text — matches an exact string
  • * — matches any string in a single path segment
  • ** — matches an arbitrary path suffix

The following table describes some potential custom URL pattern matching.

To match... Create a custom URL pattern like... Example matches to this URL pattern
An exact URL example.com/foo/baz example.com/foo/baz
Any single path segment (*) example.com/*/baz example.com/foo/baz
example.com/bar/baz
example.com/*/*/baz example.com/foo/bar/baz
example.com/bah/qux/baz
example.com/foo/* example.com/foo/baz
example.com/foo/bar

Note: This pattern will not match example.com/foo.

An arbitrary path suffix (**) example.com/foo/** example.com/foo
example.com/foo/baz
example.com/foo/baz/more/segments
subdomain.example.com/foo.bar/** subdomain.example.com/foo.bar
subdomain.example.com/foo.bar/baz
subdomain.example.com/foo.bar/baz/more/segments

View custom URL patterns and their data

The Performance dashboard of the console lists custom URL patterns that have aggregated data in both the Network > All tab and the Network > Custom tab. If a custom URL pattern doesn't have any aggregated data, then it only appears in the Network > Custom tab.

When the data retention period ends for the data aggregated under a URL pattern, Firebase deletes that data from the URL pattern. If all the data aggregated under a custom URL pattern expires, then Firebase does not delete the custom URL pattern from the Firebase console. Instead, Firebase continues to list "empty" custom URL patterns in the Network > Custom tab.

Remove a custom URL pattern

Unlike an automatic URL pattern, you can remove custom URL patterns from your project.

  1. From the Performance section of the console, go to the Network > Custom tab.

  2. Hover over the row of the custom URL pattern that you want to remove.

  3. Click at the far right of the row, then confirm the removal in the dialog.

When you remove a custom URL pattern, be aware of the following:

  • Any future requests are mapped to the next most specific matching custom URL pattern. If Firebase finds no matching custom URL patterns, then it falls back to automatic URL pattern matching.

  • Matches and aggregated data from previous requests aren't affected by removing a custom URL pattern.

    You can still access a removed custom URL pattern and its aggregated data in the Network > All tab until the end of the applicable data retention period. When all the aggregated data under the removed custom URL pattern expires, Firebase deletes the custom URL pattern.

  • The Network > Custom tab does not list any removed custom URL patterns.