Skip to content

Install on Gatsby

View as Markdown

Add Reveata to a Gatsby site from gatsby-ssr.

Add the script to every page’s <head> with onRenderBody:

tsx
// gatsby-ssr.tsx
import * as React from 'react';

export const onRenderBody = ({ setHeadComponents }) => {
  setHeadComponents([
    <script
      key="reveata"
      defer
      src="https://reveata.com/js/script.js"
      data-website-id="ws_your_tracking_id"
    />,
  ]);
};

Gatsby’s client-side navigation is tracked by the script. If you prefer to build the tag from options, @reveata/next/snippet (npm install @reveata/next) exports scriptSrc and scriptAttributes.

Was this helpful?