Theme

Start for free

Integrations ยท Site platforms

React and Vite apps: one tag in index.html.

A single-page app shares one index.html, so one tag covers every route, and history changes count as pageviews. Goals come from tally() calls in your components; revenue from the provider you connect.

Start for free

14 days free, no card needed.

01What Tally tracks

  • Each route change as a pageview, from the history API, with no router plugin.
  • Goals from tally('goal_name', props) in your code, and data-fast-goal attributes on elements.
  • Engaged time and scroll depth, counted per route.

02Where the revenue comes from

  • Checkout from your backendYour API reads the _tally_vid cookie and passes it into the checkout's metadata or custom data. The Coverage page has snippets for Node, Python, Ruby and PHP.
  • IdentifyAfter sign-in, tally('identify', { email }) lets later payments link by email, at medium confidence.

03What it can't read

  • A purchase that happens only inside the app's state, with no payment from a connected provider, isn't revenue.
  • Routes that live in the hash (#/settings) aren't counted as pages unless the tag carries data-hash.
  • Native mobile builds of the app don't load the tag, so only the web app is counted.

04Adding the snippet

Where it goes: In index.html, inside <head>: every route of the app shares it.

<script defer data-site="k3xq2mfa7twp" src="https://t.tallybyoutpost.com/script.js"></script>

This is an example site's tag. Your own, with your site's id, is on the snippet step when you add a site, and on its Setup page.

  1. Paste the tag inside the head of index.html.
  2. Run the app and open it: the live check turns green with the first visit, unless it's from localhost without data-allow-localhost.
  3. Pass the visitor's id into your checkout from the backend, and call identify after sign-in.

05Questions

  • Do I need a router integration?

    No. The tag follows the history API, which React Router and other routers use, so each navigation counts without a plugin.

  • How do I send a goal from a component?

    Call tally('signup', { plan: 'pro' }) where it happens. With the one-line queue stub in your page, calls made before the tag loads wait and go out after the first pageview.

  • Does Vite's dev server count visits?

    Not unless the tag has data-allow-localhost, so development stays out of your numbers.