• EnglishEspañol日本語한국어Português
  • Log inStart now

setPageViewName

Syntax

newrelic.setPageViewName(string $name[, string $host])

Groups page views to help URL structure or to capture the URL's routing information.

Requirements

Description

Customized page names can help you more effectively group your page views if your URL structure does not provide useful groupings or if the browser agent doesn't capture the part of the URL where routing information is stored. When querying the PageView event, the custom name will be exposed as the browserTransactionName attribute. The custom name will also be visible in the UI.

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.

Tip

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

Parameters

Parameter

Description

$name

string

Required. The page name you want to use. Use alphanumeric characters.

$host

string

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.

Examples

newrelic.setPageViewName('/login')
// Or
newrelic.setPageViewName('/login', 'https://www.myapp.com')
Copyright © 2024 New Relic Inc.

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.