Script tag
Drop one line of HTML into your site head.
NPM package
Install the tracker as a dependency in your JS app.
Server-side
POST events to the REST API from your backend.
Add the script
Paste the snippet into the <head> of every page you want to track. The defer attribute keeps it from blocking render.
<script defer data-domain="your-site.com" src="https://datakant.ai/datakant-tracker.js" ></script>
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.
bun add @datakant/tracker
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.