/example-gatsby

An example Gatsby application using Highlight.

Primary LanguageCSSBSD Zero Clause License0BSD

Gatsby 3 and Highlight Example Application

Install the Highlight Gatsby Plugin

npm install @highlight-run/gatsby-plugin-highlight

# or using Yarn
yarn add @highlight-run/gatsby-plugin-highlight

Register Highlight as a Plugin

In your gatsby-config.js:

module.exports = {
  plugins: [
    {
      resolve: "@highlight-run/gatsby-plugin-highlight",
      options: {
        orgID: 'MY_ORG_ID',
        // See all the options here: https://docs.highlight.run/reference#options
    	disableNetworkRecording: false,
    	disableConsoleRecording: false,
		enableStrictPrivacy: false,
		environment: 'production',
    	version: '5.2.3',
    	networkRecording: true,
      }
    },
  ]
}

Calling Highlight Methods

If you need to call any Highlight methods, you can do so by importing H from highlight.run

// In Component.jsx
import { H } from 'highlight.run';

const Component = () => (
	<button onClick={() => {
		H.track('fancyButtonClicked');
	}}>
		My fancy button
	</button>
);