Theme

Start for free
DocsReact and Vite

02 · Install

Add the snippet to a React or Vite app

A single-page app has one HTML file that every route shares, so the tag goes there once.

01Where it goes

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

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

02Routes

React Router, TanStack Router and the like change the address with the history API, and each change of path is a pageview. An app whose routes live after a # (/#/settings) needs data-hash on the tag:

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

03Check it worked

04Tie sales to visits

The app's backend creates the checkout, so that's where the visitor's id goes: read the _tally_vid cookie from the request and pass it to your provider. Once someone signs in, identify them with the email they pay with, so payments that carry no id can still be matched:

JavaScript
// Once the customer is signed in (or on your success page), with the email they pay with.
// It is hashed when it arrives; only the hash is kept.
window.tally = window.tally || function () { (tally.q = tally.q || []).push(arguments); };
tally('identify', { email: user.email });

05What it can't see

Something missing, or not what you see? Write to support@tallybyoutpost.com and say which page.