Skip to main content

Documentation Index

Fetch the complete documentation index at: https://revlytics.co/docs/llms.txt

Use this file to discover all available pages before exploring further.

Installation

Add the script to gatsby-ssr.js:
gatsby-ssr.js
import React from "react";

export const onRenderBody = ({ setHeadComponents }) => {
  setHeadComponents([
    <script
      key="revlytics"
      defer
      data-site="YOUR_SITE_ID"
      src="https://revlytics.co/script.js"
    />,
  ]);
};

Gatsby’s route changes

Gatsby uses @reach/router under the hood. Revlytics automatically captures client-side navigation events.

Track events

const handlePurchase = () => {
  window.revlytics?.track("purchase", { product: "ebook" });
};