0.1.16 • Published 3 years ago

@lightspeed/react-new-relic-script v0.1.16

Weekly downloads
606
License
MIT
Repository
-
Last release
3 years ago

@lightspeed/react-new-relic-script

npm version

Introduction

In serverside rendered React apps, this component renders to the browser timing header for clientside New Relic instrumentation.

Quick Start

  1. Install the dependency in your webapp.
yarn add newrelic @lightspeed/react-new-relic-script
  1. Configure New Relic by either creating a newrelic.js configuration file at the root directory of your webapp, or setting environment variables as described here. You will at least need to set the app_name and license_key configurations.

  2. Add require('newrelic'); as the first line of your application's entry point. Modules syncronously loaded New Relic will be instrumented appropriately.

  3. In your serverside rendered document component, render the <NewRelicScript /> component in the <head /> of your document. For example, in a Next.js app with serverside rendering, use the component as follows:

// app/_document.tsx
import React from 'react';
import Document, { Head, Main, NextScript, NextDocumentContext } from 'next/document';
import NewRelicScript from '@lightspeed/react-new-relic-script';

export default class MyDocument extends Document {
  render() {
    return (
      <html>
        <Head nonce={this.props.nonce}>
          <title>Lightspeed Retail - Cool Page</title>
          <NewRelicScript />
        </Head>
        <body>
          <Main />
          <NextScript />
        </body>
      </html>
    );
  }
}
0.1.16

3 years ago

0.1.15

4 years ago

0.1.14

4 years ago

0.1.13

4 years ago

0.1.12

4 years ago

0.1.11

5 years ago

0.1.10

5 years ago

0.1.9

5 years ago

0.1.8

5 years ago

0.1.7

5 years ago

0.1.6

5 years ago

0.1.5

5 years ago

0.1.4

5 years ago

0.1.3

5 years ago

0.1.2

5 years ago

0.1.1

5 years ago

0.1.0

5 years ago