newrelic.setPageViewName(string $name[, string $host])
Groups page views to help URL structure or to capture the URL's routing information.


Agent version nr-593 or higher.


Customized page names can help you more effectively group your page views if your URL structure does not provide useful groupings or if New Relic Browser doesn't capture the part of the URL where routing information is stored. The provided page view name will be used in New Relic Browser and in New Relic Insights.

To use a customized page view name instead of the page URL, format the name as a slash-delimited string. Make this call before the window load event fires in order for it to appear correctly.

This API call applies to data in standard page views in New Relic Browser and the PageView event type within New Relic Insights. To set a custom name for SPA page views and the BrowserInteraction event type, see SPA: setName. Using both calls together is recommended.


Parameter Description



Required. Name of the page you want to use when viewing it in New Relic Browser or Insights. Use alphanumeric characters.



Optional. Default is http://custom.transaction. Typically set host to your site's domain URI.

To further group these custom transactions, provide a custom host. Otherwise, the page views will be assigned the default domain custom.transaction. Segments within the name must be explicitly added to your URL allow list settings if they do not already appear.


// Or
newrelic.setPageViewName('/login', '')

For more help

Recommendations for learning more: