The snippet
One line of script, zero dependencies, ≈ 2.5 kB gzip. Paste it into the <head> and Takt starts measuring your pages — privacy-first.
Installation
Place the script as high as possible in the <head>, before your content. The defer attribute guarantees it never blocks rendering, and data-domain ties the data to the right site in your dashboard.
<script defer src="https://cdn.jsdelivr.net/npm/@vskstudio/takt-core/dist/takt.js" data-domain="example.com"></script> As soon as it loads, Takt sends a pageview for the current page and then tracks every navigation after that, including inside a SPA (History API). You don’t need to wire anything else for basic audience measurement.
Tracking an event
Beyond page views, fire custom events from your code. The global window.takt(name, options) function is available immediately, even before the script has finished loading (calls are queued).
// A simple named event
window.takt('Signup')
// With properties to segment later
window.takt('Signup', { props: { plan: 'pro' } }) A few typical use cases:
Interaction
Revenue
$ to track revenue.Journey
Downloads
data-* attribute.What’s next
- Installation — CDN, npm or the manual queue.
- Configuration — every snippet and
init()option. - Events & payload — the exact format sent to ingestion.