Is there a way to switch the account New Relic is reporting to from the frontend(javascript)?

Browser Question Template

  • Share what method you used to deploy Browser (APM or copy/paste): copy/paste

  • Which version are you using? (Lite, Pro or SPA): Pro + SPA

  • Please share your question/describe your issue below. Consider including any/all of the following:
    After successfully loading new relic with copy/paste, is there a way to switch the New Relic account that the app is reporting to from the frontend (using javascript)?

Hello, @wkang: While not officially supported by New Relic, you may be able to use JavaScript to change the license key and application ID at runtime:

1 Like

Thank you for the reply.

I have previously implemented loading different application IDs based on environment-based mapping which solved part of the problem.

But I am looking for a solution of switching the application ID after newRelic has been initialized with an application ID.

My use case:

  1. New Relic loaded with application ID for United States - (this browser account will capture any buildtime errors prior to user being located)
  2. We figure out the state the user is located in (for example New Jersey, Pennsylvania, etc)
  3. Update New Relic application ID to New Jersey browser account - (this browser account will capture all New Jersey based errors)

I have not heard of anyone else doing this. Perhaps a member of the community will have a suggestion.

Hi @wkang,

I actually see that you have an open support ticket for this, I recognized the question because I was just talking to a colleague about it. You should see a response there soon, and if there’s anything that’s relevant to the wider user audience we can update this post as that discussion evolves.

2 Likes

I have ran into this question/issue too. Not sure if New Relic can support it now.

I am also looking for a solution of switching the application ID after newRelic has been initialized with an application ID.

hi, @hwilkalis @philweber does New Relic support it now?

Looking forward to your update.

Thanks

Hi @lulu.yang Appreciate your followup on this thread but given how long ago this conversation happened I would advise opening up a new topic with the specifics of the issue your are experiencing. That would help our support team to triage appropriately. Thanks :slight_smile: