Lightweight JavaScript analytics and telemetry beacon
Universal sub-3.2 KB asynchronous JavaScript tracker. Zero external dependencies, cookieless daily hashing, Core Web Vitals RUM, and automated crash capture.
<script defer src="https://api.openanalytics.org.in/open.js" data-project-id="YOUR_PROJECT_ID"></script>Complete JavaScript Integration Guide
Follow these steps to track pageviews, custom events, Core Web Vitals, and errors.
1Embed Script Tag
Place the script tag in your document `<head>`. The `defer` attribute ensures non-blocking execution while preserving initial load paint performance.
<script defer src="https://api.openanalytics.org.in/open.js" data-project-id="prj_your_project_id" ></script>
2Configuration Data Attributes
Configure custom reporting endpoints or publishable API keys directly via script data attributes.
<script defer src="https://api.openanalytics.org.in/open.js" data-project-id="prj_your_project_id" data-endpoint="https://analytics.yourcompany.com" data-api-key="pk_live_optional_key" ></script>
3Global Window API Methods
Once initialized, Open Analytics exposes a clean global namespace on `window.OpenAnalytics`.
// Manual Pageview (for custom router implementations)
window.OpenAnalytics.page("/virtual-page-url");
// Custom Event Dispatch
window.OpenAnalytics.track("signup_modal_opened", { source: "header" });
// Manual Error Reporting
window.OpenAnalytics.captureError(new Error("Network timeout"), { retries: 3 });Attaching Custom Event Listeners
Track button clicks or form submissions using standard vanilla JavaScript event listeners.
document.getElementById("cta-button")?.addEventListener("click", () => {
if (window.OpenAnalytics) {
window.OpenAnalytics.track("demo_requested", {
plan: "enterprise",
page_scroll_depth: Math.round((window.scrollY / document.body.scrollHeight) * 100),
});
}
});Automated Field Performance
The vanilla beacon listens to W3C PerformanceObserver entries for LCP, INP, CLS, FCP, and TTFB passively in the background, flushing metrics when the visitor hides the tab or completes a session.
Runtime Crash Triage
Attaches global listeners to `window.onerror` and `window.onunhandledrejection`, automatically packaging stack traces, script origins, and action breadcrumbs for edge ingestion.
Frequently Asked Questions
Add Open Analytics to your JavaScript app today
Zero cookies, sub-3.2 KB payload, real-time Core Web Vitals RUM, and automated crash triage.