-
Notifications
You must be signed in to change notification settings - Fork 0
The Snippet
One line of script, zero dependencies, ≤ 1 kB gzip. Paste it into the <head> and Takt starts measuring your pages — privacy-first.
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>The snippet automatically excludes localhost and private IPs, and respects Do Not Track. So in local development you won't see anything come through — that's expected.
Need to sample traffic, keep specific query params, or toggle a guardrail? The base snippet reads optional data-* attributes (data-sample-rate, data-track-query, data-query-params, data-respect-dnt, data-enabled) for all of that — see Configuration.
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.
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 — Clicking a CTA, opening a modal, submitting a form.
-
Revenue — Attach an amount to a purchase with
$to track revenue. - Journey — Onboarding or funnel steps to spot friction points.
-
Downloads — PDFs, exports, outbound links — enabled with a single
data-*attribute.
- Installation — CDN, npm or the manual queue.
-
Configuration — every snippet and
init()option. - Events & payload — the exact format sent to ingestion.
Source: github.com/vskstudio/takt-core · npm @vskstudio/takt-core
- Home
- The-Snippet
- Installation
- Configuration
- Vanilla-JS
- Events-and-Payload
- Privacy
- Widgets
- API-Reference
React · Vue · Svelte wrappers: see the docs site.