Customize network request data aggregation

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

Sometimes, though, you need to customize how Firebase aggregates specificnetwork request data to better support your app's use cases. We provide two waysthat you customize data aggregation for network requests:aggregate data undercustom URL patterns andcustomize how success rate is calculated.

Aggregate data under custom URL patterns

For each request, Firebase checks if the network request's URL matches aURL pattern. If the request URLmatches a URL pattern, Firebase automatically aggregates the request's dataunder the URL pattern.

You can createcustom URL patterns to monitor specific URL patterns thatFirebase isn't capturing with its derivedautomatic URL patternmatching. For example,you can use a custom URL pattern to troubleshoot a specific URL or to monitor aspecific set of URLs over time.

Firebase displays all URL patterns (including custom URL patterns) and theiraggregated data in theNetwork requests subtab of the traces table, which isat the bottom of thePerformance dashboard of theFirebase console.

How does custom URL pattern matching work?

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

If a request's URL matches more than one custom URL pattern, Firebase maps therequest to themost specific custom URL pattern only, according to thefollowing specificity order:plain text >* >**from left toright in the path. For example, a request toexample.com/books/dog matchestwo custom URL patterns:

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

However, the patternexample.com/books/* is themost specific matching URL pattern because theleftmost segmentbooks inexample.com/books/* takes precedence over theleftmost segment* inexample.com/*/dog.

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

  • Matches and aggregated data fromprevious requests aren't affected bycreating a new custom URL pattern. Firebase does not retroactivelyre-aggregate request data.

  • Onlyfuture requests are affected by creating a new custom URL pattern.You might need to wait up to 12 hours forPerformance Monitoring to collect andaggregate data under a new custom URL pattern.

Create a custom URL pattern

You can create a custom URL pattern from theNetwork requests subtab in thetraces table, which is at the bottom of thePerformance dashboard of theFirebase console.

A project member must be anOwner or Editor tocreate a new custom URL pattern; however, all project members can view customURL patterns and their aggregated data.

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

To create a custom URL pattern, start with a hostname, followed by pathsegments. The hostname must include a valid domain, and can optionally includethe subdomain. Use the following path segment syntax to create a pattern thatcan match URLs.

  • plain text — matches an exact string
  • * — matches the first subdomain segment, or 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 URLexample.com/foo/bazexample.com/foo/baz
Any single path segment (*)example.com/*/bazexample.com/foo/baz
example.com/bar/baz
example.com/*/*/bazexample.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 matchexample.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
The first subdomain segment (*)*.example.com/foobar.example.com/foo
baz.example.com/foo
Note: For custom URL patterns, Firebase does not support the syntax of*.file-extension, like*.png or*.css.

View custom URL patterns and their data

Firebase displays all URL patterns (including custom URL patterns) and theiraggregated data in theNetwork requests subtab of the traces table, which isat the bottom of thePerformance dashboard of theFirebase console.

To viewonly custom URL patterns, selectCustom patterns from the dropdownmenu in theNetwork requests subtab of the traces table. Note that if a customURL pattern doesn't have any aggregated data, then it only appears in this list.

When thedata retention periodends for the data aggregated under a URL pattern, Firebase deletes that datafrom the URL pattern. If all the data aggregated under a custom URL patternexpires, then Firebase doesnot delete the custom URL pattern from theFirebase console. Instead, Firebase continues to list "empty" custom URLpatterns in theCustom patterns list of theNetwork requests subtab of thetraces table.

Remove a custom URL pattern

You can remove custom URL patterns from your project. Note that you cannotremove an automatic URL pattern.

  1. From thePerformancedashboard,scroll down to the traces table, then select theNetwork requests subtab.

  2. SelectCustom patterns from the dropdown menu in theNetwork requestssubtab.

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

  4. Click at the far right of therow, selectRemove custom pattern, then confirm the removal in the dialog.

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

  • Anyfuture requests are mapped to thenext most specific matchingcustom URL pattern. If Firebase finds no matching custom URL patterns, thenit falls back toautomatic URL pattern matching.

  • Matches and aggregated data fromprevious requests aren't affectedby removing a custom URL pattern.

    You can still access a removed custom URL pattern and its aggregateddata in theNetwork requests subtab (withAll network requests selected)until the end of the applicable data retention period. When all theaggregated data under the removed custom URL pattern expires, Firebasedeletes the custom URL pattern.

  • TheNetwork requests subtab (withCustom patterns selected) does notlist any removed custom URL patterns.

Next steps

  • Set up alerts for network requests that are degradingthe performance of your app. For example, you can configure an email alert foryour team if theresponse time for a specific URL pattern exceeds athreshold that you set.

Customize how success rate is calculated

One of the metrics that Firebase monitors for each network request is therequest's success rate. Success rate is the percentage of successful responsescompared to total responses. This metric helps you to measure network and serverfailures.

Specifically, Firebase automatically counts network requests with a responsecode in the range of 100 - 399 as successful responses.

You can customize the success rate calculation by counting certain error codesas "successful responses" in addition to the response codes that Firebaseautomatically counts as successful.

For example, if your app has a search endpoint API, you can count 404 responsesas "successful" because 404 responses are expected for a search endpoint.Suppose there are 100 samples for this search endpoint every hour, and 60 ofthem are 200-responses and 40 of them are 404-responses. Before you configurethe success rate, the success rate will be 60%. After you configure the successrate calculation to count 404 responses as successful, the success rate will be100%.

Note: New success rate configurations only apply to data collected after theconfiguration is created.

Configure success rate calculation

To configure the success rate calculation for a network URL pattern, you musthave thefirebaseperformance.config.update permission. The following rolesinclude this required permission by default:Firebase Performance Admin,Firebase Quality Admin,Firebase Admin,and projectOwner or Editor.

  1. Go to thePerformance MonitoringDashboardtab in theFirebase console, then select the app for which you want toconfigure a success rate calculation.
  2. Scroll down to the traces table at the bottom of the screen and select theNetwork requests tab.
  3. Find the URL pattern for which you want to configure the success ratecalculation.
  4. At the far right of the row, open the overflow menu() and selectConfigure successrate.
  5. Follow the on-screen instructions to select response codes that you want tocount as successful response codes.
Note: You can configure success rate for both automatic and custom URL patterns.It is recommended that you only configure success rate for custom URL patternsbecause automatic URL patterns can change over time as your data changes.

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-12-17 UTC.