DocsQuick Start: Install ViaMetric
Quick Start: Install ViaMetric
Get up and running in under 2 minutes. Install the tracking script on HTML, Next.js, or any web framework.
ViaMetric works by adding a lightweight (2kb) tracking script to your website. It doesn't use cookies, so you don't need complex consent banners for basic tracking.
1. Get your Website ID
- Log in to your ViaMetric Dashboard.
- Go to Settings > General.
- Copy your Website ID (e.g.,
vm_123456).
2. Add the Script
Plain HTML
Add this line inside the <head> or <body> of your index.html:
<script defer src="https://viametric.app/events.js" data-website-id="YOUR_WEBSITE_ID"></script>
Next.js (App Router)
Add it to your root layout.tsx:
export default function RootLayout({ children }) {
return (
<html lang="en">
<body>
{children}
<script
defer
src="https://viametric.app/events.js"
data-website-id="YOUR_WEBSITE_ID"
/>
</body>
</html>
)
}
React / Vue / SPA
If you are using a Single Page Application, place the script in your index.html (public folder). ViaMetric handles route changes automatically by listening to the browser's History API.
3. Verify Installation
- Deploy your changes.
- Visit your website.
- Go to your ViaMetric Dashboard.
- You should see your visit appear in "Realtime" within 30 seconds.
Troubleshooting
- No data? Check your browser console. If you use an AdBlocker, it might block the script. Try opening your site in Incognito mode.
- Localhost: We track
localhostby default so you can test during development.
