Platform Installation Guides
Step-by-step instructions for adding Tallytics to every major platform. Same script tag, different locations.
<script defer src="https://tallycdn.com/t.js" data-site="your-site-id"></script>
WordPress
Theme header or plugin
Next.js
App Router or Pages Router
Nuxt / Vue
nuxt.config or index.html
Shopify
theme.liquid
Gatsby
gatsby-ssr / html.js
Squarespace
Code Injection
Google Tag Manager
Custom HTML tag
Static HTML
Direct <head> paste
WordPress
Two options depending on whether you want to edit theme files or use a plugin.
Option A: Theme header (recommended)
-
Open the Theme Editor
Go to Appearance → Theme File Editor in your WordPress admin.
-
Open header.php
Select
header.phpfrom the file list on the right. -
Paste the script
Add the Tallytics snippet just before the closing
</head>tag:header.php<!-- Tallytics Analytics --> <script defer src="https://tallycdn.com/t.js" data-site="your-site-id"></script> </head> -
Save
Click Update File. Tracking starts immediately.
Option B: Plugin
If you'd rather not edit theme files, install a "Header Scripts" plugin like Insert Headers and Footers or WPCode:
- Install and activate the plugin
- Go to the plugin's settings page
- Paste the Tallytics script in the Header Scripts section
- Save — done
header.php instead. Changes to the parent theme will be lost on updates.
Next.js
Works with both the App Router (Next.js 13+) and Pages Router.
App Router (recommended)
Add the script to your root layout:
export default function RootLayout({ children }) {
return (
<html lang="en">
<head>
<script
defer
src="https://tallycdn.com/t.js"
data-site="your-site-id"
/>
</head>
<body>{children}</body>
</html>
)
}
Pages Router
Add to pages/_document.tsx:
import { Html, Head, Main, NextScript } from 'next/document'
export default function Document() {
return (
<Html>
<Head>
<script
defer
src="https://tallycdn.com/t.js"
data-site="your-site-id"
/>
</Head>
<body>
<Main />
<NextScript />
</body>
</Html>
)
}
Nuxt / Vue
Nuxt 3
Add the script in nuxt.config.ts:
export default defineNuxtConfig({
app: {
head: {
script: [
{
src: 'https://tallycdn.com/t.js',
defer: true,
'data-site': 'your-site-id',
},
],
},
},
})
Vue (Vite)
Add the script tag to index.html in your project root:
<head>
<!-- ... other tags ... -->
<script defer src="https://tallycdn.com/t.js" data-site="your-site-id"></script>
</head>
Gatsby
Use the gatsby-ssr.js file to inject the script server-side:
export const onRenderBody = ({ setHeadComponents }) => {
setHeadComponents([
<script
key="tallytics"
defer
src="https://tallycdn.com/t.js"
data-site="your-site-id"
/>,
])
}
Remix
Add the script in your root route's <head>:
export default function App() {
return (
<html lang="en">
<head>
<Meta />
<Links />
<script
defer
src="https://tallycdn.com/t.js"
data-site="your-site-id"
/>
</head>
<body>
<Outlet />
<Scripts />
</body>
</html>
)
}
Astro
Add to your base layout component:
<html lang="en">
<head>
<!-- ... other tags ... -->
<script defer src="https://tallycdn.com/t.js" data-site="your-site-id"></script>
</head>
<body>
<slot />
</body>
</html>
<script> tag, not Astro's <script> component — Astro would try to bundle it. The is:inline directive also works if you prefer Astro syntax.
SvelteKit
Add to your root app.html:
<head>
%sveltekit.head%
<script defer src="https://tallycdn.com/t.js" data-site="your-site-id"></script>
</head>
Hugo
Add to your base template's <head> partial:
<!-- Tallytics Analytics -->
{{ if not .Site.IsServer }}
<script defer src="https://tallycdn.com/t.js" data-site="your-site-id"></script>
{{ end }}
The {{ if not .Site.IsServer }} conditional skips tracking during local development with hugo server.
Jekyll
Add to your default layout or head include:
{% if jekyll.environment == "production" %}
<script defer src="https://tallycdn.com/t.js" data-site="your-site-id"></script>
{% endif %}
Use JEKYLL_ENV=production jekyll build to enable tracking only in production.
Shopify
-
Open the theme editor
Go to Online Store → Themes → Actions → Edit code.
-
Open theme.liquid
In the Layout folder, click
theme.liquid. -
Paste the script
Add the Tallytics snippet just before
</head>:theme.liquid<script defer src="https://tallycdn.com/t.js" data-site="your-site-id"></script> </head> -
Save
Click Save. Tracking is live on all pages including checkout.
WooCommerce
WooCommerce runs on WordPress, so follow the WordPress guide above. The script tag in header.php will automatically cover all WooCommerce pages — shop, product, cart, and checkout.
To track purchases as custom events, add this to your Thank You page template or via a plugin:
<script>
tallytics.track('purchase_completed', {
order_total: '{{ order.total }}',
items: '{{ order.item_count }}'
})
</script>
Squarespace
-
Open Code Injection
Go to Settings → Advanced → Code Injection.
-
Paste in Header
Add the Tallytics script in the Header field:
<script defer src="https://tallycdn.com/t.js" data-site="your-site-id"></script> -
Save
Click Save. Tracking covers all pages on your Squarespace site.
Webflow
-
Open Project Settings
In the Webflow Designer, go to Project Settings → Custom Code.
-
Paste in Head Code
Add the Tallytics script in the Head Code section:
<script defer src="https://tallycdn.com/t.js" data-site="your-site-id"></script> -
Publish
Save and publish your site. Tracking starts on the next deploy.
Wix
-
Open Custom Code
Go to Settings → Custom Code (under Advanced).
-
Add code
Click + Add Code and paste the Tallytics script.
-
Configure placement
Set placement to Head, apply to All pages, and load on All pages.
-
Apply
Click Apply. The code goes live with your next publish.
Google Tag Manager
If you're already using GTM and want to manage the Tallytics script through it:
-
Create a new tag
In GTM, click Tags → New. Choose Custom HTML as the tag type.
-
Paste the script
<script defer src="https://tallycdn.com/t.js" data-site="your-site-id"></script> -
Set the trigger
Choose All Pages as the trigger (fires on every page load).
-
Publish
Save the tag and click Submit to publish your container.
Static HTML
For plain HTML sites, paste the script in the <head> of every page:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>My Website</title>
<script defer src="https://tallycdn.com/t.js" data-site="your-site-id"></script>
</head>
<body>
<!-- Your content -->
</body>
</html>
If you have many pages, consider using a static site generator or a shared header include to avoid repeating the tag.