Skip to content

Getting started

One script tag. No package, no build step, no framework.

<script src="https://insightjs.com/l.js"></script>
<script>
  InsightJS.init({
    endpoint: 'https://analytics.insightjs.com',
    release: 'a41f9c2',
  })
</script>

The tag finds its ingestion endpoint from its own src; init() is optional and uses the same values by default. Put the second block directly after the tag: the first page view is deferred one task so init() applies before it leaves.

What is collected automatically

signal when
page view load, and every SPA route change (pushState, replaceState, back/forward)
LCP the largest contentful paint entry
CLS layout shifts without recent input
INP the slowest interaction; FID is reported as a fallback
TTFB, DOMContentLoaded, load the navigation timing entry
errors error and unhandledrejection, with counts and a short message
session summary on pagehide or when the tab becomes hidden

Details and units are in Web vitals and Errors. The wire format is in Events and payload.

Check that it works

  1. Open the browser's network panel.
  2. Reload the page.
  3. Look for a POST to /speed with a JSON body that starts with {"payload":.

The client does not retry and does not read the response. A beacon that fails is gone; keep the endpoint reachable.

Custom events

InsightJS.track('signup', { plan: 'pro' })

track() rides the same envelope as a page view. The name and properties travel inside the opaque session record; they add no fields to the envelope itself.

Stopping it

<script>
  window.insightjsConfig = { disabled: true }
</script>
<script src="https://insightjs.com/l.js"></script>

Or call InsightJS.init({ disabled: true }) in the inline block shown above. See Configuration for every option.