LiveSession and Gatsby integration
LiveSession provides a plugin that lets you install script even more easily.
In your project run
npm i @livesession/gatsby-plugin-livesession
or
yarn add @livesession/gatsby-plugin-livesession
Go to gatsby-config.js file and add a plugin, everything that you need is trackID:
// gatsby-config.js
plugins: [{
resolve: '@livesession/gatsby-plugin-livesession',
options: {
trackID: YOUR_LIVESESSION_TRACKID, // Required, string
keystrokes: true || false, // Optional, default to false
rootHostname: '.example.com', // Optional
},
}];
Plugin adds script only in production mode.
If you want to know more about options you can pass into config, go to LiveSesion Developers page.