Developer docs

Install datakant

Get up and running in under five minutes. Add the tracking snippet, install the NPM package, or call the REST API.

v3.0Updated May 2026

Add the script

Paste the snippet into the <head> of every page you want to track. The defer attribute keeps it from blocking render.

HTML
<script
  defer
  data-domain="your-site.com"
  src="https://datakant.ai/datakant-tracker.js"
></script>
Tip

Replace your-site.com with the domain you registered in the datakant dashboard. The tracker auto-detects pageviews, clicks, and form submissions out of the box.

Install via NPM

Prefer a bundled approach for React, Next.js, Vue, or Svelte? Install the tracker package and call init() once in your app entry point.

Shell
bun add @datakant/tracker
TypeScript
import { init } from "@datakant/tracker";

init({
  trackingId: "dk_xxxxxxxxxxxxxxxx",
  endpoint:   "https://datakant.ai",
});

Server-side install

If your stack does the ingest from a server (Node, Bun, Deno, Go, Python), you can POST events directly to /api/events/ingest. See the Ingest endpoint reference for the full payload schema — coming soon.