• /
  • ログイン

CSP v2: Monitor Salesforce

Salesforce has strict requirements about Content Security Policy (CSP) v2. In this situation, you must copy and paste the New Relic Browser agent's JavaScript code and self-host it as a .js file. This allows the page to reference the .js file during page load.

Contents

Requirements

In order to use New Relic Browser to monitor Salesforce Lightning pages, make sure you follow these requirements:

CSP and Salesforce Lightning

Browser agent requirements

Application or platform

Your app or platform where your site is hosted must meet New Relic Browser's standard compatibility requirements. Exception: CSP restrictions prevent you from linking an APM app for Browser monitoring.

Subscription

You must have a Pro+SPA Browser subscription for your app.

Host location for domains

The .js file for New Relic Browser must be hosted on a highly available or replicated location, such as a CDN or distributed network. This helps ensure performance is not affected. Follow the Salesforce procedures to add New Relic Browser URLs to your CSP whitelist.

Browser agent version

  • Your selected app must use the latest Browser agent version.
  • You must manually update the .js file whenever the New Relic Browser agent version is updated. New Relic Browser cannot make this change automatically for Salesforce Lightning apps.

1. Whitelist New Relic Browser domains

Follow the Salesforce procedures to add New Relic Browser URLs to your CSP whitelist. Add both of these New Relic Browser domains to your CSP whitelist:

  • https://js-agent.newrelic.com: This is where the New Relic Browser agent is hosted. The Browser agent download requires three files to run. Two are downloaded after the initial agent is run to continue capturing performance data.
  • https://bam.nr-data.net: This is the endpoint where the New Relic Browser agent receives data from your site.

2. Copy Browser app's JS snippet

To create and host a .js file, you must first copy the Browser agent's JavaScript snippet from the hosting app.

  1. Go to rpm.newrelic.com/browser.
  2. From the list of Browser apps, select the app for which you want to self-host the Browser agent.
  3. Select Settings > Application settings > Copy/paste JavaScript code.
  4. Copy the Browser agent's JavaScript snippet.
  5. Save and exit the Browser app's Application settings page.

Continue with the procedures to create a .js file for your page.

3. Create .js file for page

After you copy the Browser agent's JavaScript snippet from the selected Browser app:

  1. Open a text editor and paste the Browser agent's JavaScript snippet.
  2. Delete the first line (<script type="text/javascript">) and the last line of the JavaScript snippet (</script>).
  3. Save the text file as nr-spa-AGENT_VERSION.min.js, where AGENT_VERSION is the latest Browser agent version.
  4. Upload the .js file to your Salesforce external JavaScript libs directory, and reference the .js file in the <head> of your webpage.

After you install the Browser agent's JavaScript snippet, you can use the New Relic Browser UI to monitor website performance.

4. Keep Browser agent up to date

You must manually update the .js file whenever New Relic updates the Browser agent version. New Relic Browser cannot make this change automatically for Salesforce Lightning apps.

その他のヘルプ

さらに支援が必要な場合は、これらのサポートと学習リソースを確認してください:

問題を作成するこのページを編集する
Copyright © 2020 New Relic Inc.