-
Notifications
You must be signed in to change notification settings - Fork 0
Configuration
Takt is configured in two equivalent ways: via data-* attributes on the snippet tag (CDN), or via init() options (npm). Both drive the same settings.
| Attribute | Effect | Default |
|---|---|---|
data-domain |
Site identifier in your dashboard | location.hostname |
data-endpoint |
Event ingestion endpoint | /api/event |
data-outbound |
Tracks clicks on outbound links (flag) | off |
data-files |
Tracks file downloads (flag) | off |
data-exclude-localhost="false" |
Also measures localhost / private IPs | excluded |
-
data-domain— always set it explicitly. Without it, Takt infers the domain fromlocation.hostname, which breaks aggregation if your site responds on several hosts (www, staging, test domain). -
data-endpoint— changes the URL events are posted to. Useful behind a proxy or a dedicated ingestion subdomain. -
data-outbound/data-files— these are flags: their mere presence activates them, regardless of value. Just writedata-outbound(no need for="true"). -
data-exclude-localhost— enabled by default. Pass"false"to also measure localhost and private IPs. -
Do Not Track — the snippet always respects the DNT header; there is no attribute to disable it. To drive this guardrail, use the npm
respectDntoption.
<script
defer
src="https://cdn.jsdelivr.net/npm/@vskstudio/takt-core/dist/takt.js"
data-domain="example.com"
data-outbound
data-files
></script>The
data-exclude-localhostflag protects your visitors' privacy, and the snippet always respects Do Not Track. Only disable these guardrails if you know exactly why.
In the npm version, these same settings are passed as an object to init() (in camelCase for booleans):
import { init } from '@vskstudio/takt-core'
init({
domain: 'example.com', // required in practice
endpoint: '/api/event', // optional
outbound: true, // tracks outbound links
files: true, // tracks downloads
excludeLocalhost: true, // default
respectDnt: true // default
})init() creates a shared instance, fires an automatic pageview and wires up SPA navigation. Call it only once, at application startup.
These settings have no data-* equivalent; they are only available in an npm integration:
| Option | Type | Default | Role |
|---|---|---|---|
enabled |
boolean |
true |
Stops all sending when false (handy in staging) |
debug |
boolean |
false |
Logs every event to the console |
sampleRate |
number |
1 |
Samples sent events (0–1) |
trackQuery |
boolean |
false |
Keeps the query string as-is |
queryParams |
string[] |
— | Allowlist of query params to keep |
scrubUrl |
(url) => url |
— | Custom URL scrubbing |
By default, the query string and hash are stripped from every URL before sending. The snippet always applies this scrubbing; trackQuery/queryParams/scrubUrl let you tune it on the npm side. See Privacy.
Name mapping:
data-exclude-localhost→excludeLocalhost. The semantics are identical between snippet and npm for the shared settings.
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.