Documentation

Everything you need to integrate Begins Insights into your website and applications.

Quick Start

1. Install the Tracking Script

Add this script to your website, just before the closing </body> tag:

<script> (function() { fetch('https://insights.begins.site/api/track', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ id: 'visitor_' + Math.random().toString(36).substring(2) + Date.now(), page: window.location.pathname, referrer: document.referrer || 'direct' }) }).catch(console.error); })(); </script>

API Reference

POST /api/track
Track

Track a page view or event.

fetch('/api/track', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ id: 'visitor_123', page: '/home', referrer: 'google.com' }) })
GET /api/track
Analytics

Get analytics data.

fetch('/api/track') .then(response => response.json()) .then(data => console.log(data))