Gatsby builds static pages and then behaves like a single-page app in the browser. Reveata follows both: the script is rendered into each page's head at build time and follows navigation through the History API afterwards.
What you get
- Every page view, the first full load and every client-side navigation after it.
- Traffic sources and campaigns for each visit, including AI assistants, search engines and tagged links (UTM and ref parameters).
- Scroll depth, outbound clicks and time on page, recorded by the script by default.
- Goals from attributes or code (custom goals).
- Revenue attribution for payment links and checkouts started from your pages.
How to install it
Use onRenderBody in gatsby-ssr.js (or .tsx) to add the script to every page:
export const onRenderBody = ({ setHeadComponents }) => {
setHeadComponents([
<script
key="reveata"
defer
data-website-id="ws_your_tracking_id"
src="https://reveata.com/js/script.js"
/>,
]);
};Rebuild and deploy. If you prefer to build the tag from options, @reveata/next/snippet exports scriptSrc and scriptAttributes. The API is described in Gatsby's gatsby-ssr reference (opens in a new tab).
Revenue from a Gatsby site
| How you sell | How the sale finds its visit |
|---|---|
| Stripe Payment Link or Buy Button on a page | The script adds the visitor id on click (details) |
| A serverless function that creates a checkout | Send window.reveata.metadata() and put the ids in the checkout metadata |
| Your own billing | The Payments API |
Serving the script from your own domain
A static Gatsby site can use its host's rewrites (Proxy through your own server) or the managed proxy, which needs one DNS record.