Theme

Start for free
DocsThe snippet

02 · Install

One tag in the head of every page

Paste one tag into your pages and Tally counts visits, sources, engaged time, goals and clicks on outbound links, and has a visitor id for your checkout to carry.

01The tag

One <script> tag runs everything. It weighs about 3 KB, has no dependencies and loads with defer, so it never holds up your page:

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

Your site's own tag is on the snippet step when you add the site, and on its Setup page, with its id in data-site. A site counted cookieless or consent first carries its mode too:

Show the code for

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

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

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

Script configuration lists every attribute it reads.

02Where it goes on your platform

PlatformWhere
HTMLPaste it into the <head> of every page.
Next.jsIn app/layout.tsx, the root layout: inside its <head>.
React and ViteIn index.html, inside <head>: every route of the app shares it.
WordPressIn a classic theme's header.php, just before </head>, or in a header-code plugin.
WebflowSite settings › Custom code › Head code, then publish.
FramerSite settings › General › Custom code, at the end of the <head> tag, then publish.
ShopifyOnline Store › Themes › Edit code › layout/theme.liquid, just before </head>.

A single-page app needs nothing more: each route the app moves to is a pageview of its own.

03What it sends

  • Pageviews: the first when the page loads, then one for each route of a single-page app (pushState, replaceState and the back button). A change of query or hash alone isn't a new page, unless the tag has data-hash.
  • Engaged time and scroll depth: time counts while the page is visible and someone used it in the last 30 seconds. It's reported when the page is hidden or left, and every 30 seconds while it runs.
  • Goals, from your code or a data-tally-goal attribute (Goals and identify).
  • Clicks on links to other sites, sent as the browser leaves, without holding up the click.
  • An email to match buyers by, when your page calls identify.

Events go as JSON to /api/event on the script's own address, without cookies. The script never throws an error into your page and never delays a navigation.

04Check that it works

05What it can't count

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