Documentation

Everything you need to integrate Dwellcount into your website or application.

Quick Start

Script Tag

Fastest way to start

<script
  src="https://cdn.dwellcount.com/tracker.js"
  data-site-id="YOUR_SITE_ID"
  defer
></script>

NPM Package

For bundled apps

npm install @dwellcount/tracker

import { init } from '@dwellcount/tracker';
init({ siteId: 'YOUR_SITE_ID' });

Self-Hosting Guide

Deploy Dwellcount on your own infrastructure with all features included. Requirements: 2GB RAM VPS, Docker, and a domain with HTTPS.

Quick Setup

# Clone the repository
git clone https://github.com/TheDecipherist/dwellcount.git
cd dwellcount

# Copy environment template
cp .env.example .env

# Edit .env with your settings
nano .env

# Start with Docker Compose
docker-compose up -d

Environment Variables

# Required
MONGODB_URI=mongodb://localhost:27017
MONGO_DB_NAME=dwellcount
NEXTAUTH_SECRET=your-secret-key
NEXTAUTH_URL=https://analytics.yourdomain.com

# Optional
SMTP_HOST=smtp.example.com
SMTP_USER=your-email
SMTP_PASS=your-password

API Reference

Tracker Methods

  • init(config)Initialize the tracker
  • track(event, data)Track custom event
  • identify(userId, traits)Identify a user
  • setConsent(granted)Set tracking consent

REST API

  • POST /api/ingestIngest events
  • GET /api/sessionsList sessions
  • GET /api/analytics/overviewGet analytics summary
  • GET /api/analytics/heatmapGet heatmap data