Install Tracking
Gurulu supports multiple installation methods. Pick the one that matches your stack. All methods auto-detect events, capture errors, and build flow graphs out of the box.
Script tag
The simplest approach. Add the following snippet before </head> in your HTML:
<script
src="https://cdn.gurulu.io/t.js"
data-site-id="YOUR_SITE_ID"
data-token="YOUR_TOKEN"
async
></script>The script is ~4 KB gzipped and loads asynchronously. It never blocks rendering.
npm package
npm install @gurulu/trackerimport { init } from '@gurulu/tracker';
init({
siteId: 'YOUR_SITE_ID',
token: 'YOUR_TOKEN',
});Call init() once at app startup. The tracker registers itself and begins capturing pageviews and events.
CLI auto-install
The CLI detects your framework and injects the tracker automatically:
npx @gurulu/cli initIf the CLI cannot detect the framework, pass it explicitly with --framework.
Framework guides
Next.js (App Router)
npx @gurulu/cli init --framework nextjs-appAdds the tracker to your root layout. Works with both server and client components.
Next.js (Pages Router)
npx @gurulu/cli init --framework nextjs-pagesInjects the script into _app.tsx or _document.tsx.
React (Vite)
npx @gurulu/cli init --framework react-viteimport { init } from '@gurulu/tracker';
init({ siteId: 'YOUR_SITE_ID', token: 'YOUR_TOKEN' });
// ... rest of your appVue 3
npx @gurulu/cli init --framework vue3import { init } from '@gurulu/tracker';
init({ siteId: 'YOUR_SITE_ID', token: 'YOUR_TOKEN' });
// createApp(App).mount('#app');Svelte
npx @gurulu/cli init --framework svelteAstro
npx @gurulu/cli init --framework astroPlain HTML
Use the script tag method above. No build step required.
Configuration options
The tracker accepts these optional settings:
trackErrors: true— capture unhandled exceptions (default: true)trackClicks: true— auto-detect click events (default: true)trackForms: true— track form submissions (default: true)trackScroll: true— capture scroll depth (default: true)respectDnt: false— honor Do Not Track header (default: false)
Verify
After installing, see Verify Events to confirm data is flowing.