Setcustom attribute not visible in PageView event

Hi team ,
we have added javascript part, following link
https://docs.newrelic.com/docs/browser/new-relic-browser/browser-agent-spa-api/setcustomattribute-browser-agent-api

var _trackingName = ‘’

    trackingName = jQuery("a[id=trackingName]").attr("title")

    if (typeof newrelic == 'object') {

        newrelic.setCustomAttribute('trackingName', trackingName);

    }

tested locally this script its working fine

but when checked in newrelic insights using query
select trackingName from PageView

we see no value., please help.

@pmohite Hi there! One common thing we see pop up often when using this SPA API call is making sure that it happens before the window load event fires (when that data is transmitted) in order for the attributes to be included in the PageView event.

Are there any other differences between the local version and production? And to confirm, you are seeing the data in PageView when testing locally? Can you please provide a link to your account? Thanks!

thanks for your reply ,
i was testing on local server , where new relic js has limitation .
now after deploying on dev server its working fine … thank you .

Thanks @cfrankenfield and @pmohite for the clarifications here :slightly_smiling_face: Please let us know if you run into any further issues.

1 Like