fivebar

Gatsby

Copy page
View Markdown
Open with
Connect MCP
Claude Mistral Vibe Cursor VS Code

Add the tag to every page of a Gatsby site, from gatsby-ssr.js.

Add the tag to every page’s head from gatsby-ssr.js, at the root of your site, with onRenderBody:

import React from 'react';

export const onRenderBody = ({ setHeadComponents }) => {
  setHeadComponents([
    <script key="fivebar" async data-domain="example.com" src="https://fiveb.ar/js/tally.js" />,
  ]);
};

Rebuild the site for it to take effect. Gatsby moves between pages without loading them, and each is counted as a single-page app’s. See Gatsby’s server rendering APIs.

Once it’s live, check it works.