// context projectglobal

Install & Configure

The browser SDK is a single <script> tag. Every behavior is toggled via data-* attributes. Nothing extra to install, no build step on your side.

Minimal install

<script
  src="https://app.logu.ro/loguro.js"
  data-api-key="brk_xxxxxxxxxxxx"
  data-analytics="all"
></script>

This is what most sites should use. Pageviews, custom events, auto-events, vitals, network capture — all on.

All attributes

Required

AttributeDefaultNotes
data-api-keyYour browser-scoped key (starts with brk_). Generate one from project settings. Missing it = script logs a warning and exits silently.

Endpoint / transport

AttributeDefaultNotes
data-endpointhttps://ingest.logu.roBase URL. Override for self-hosted, staging, or proxy setups. Trailing / is trimmed. /batch is auto-derived.
data-tracetrueGenerates a session UUID, sent on every request as X-Request-Id. Set to false to disable.
data-max-per-minute1000Shared rate limit for logs + analytics. Exceeding it silently drops events for the rest of the minute.

Logging (independent of analytics)

AttributeDefaultEffect
data-interceptallWhich console.* methods to capture. CSV: error,warning,info,debug — or all / none.
data-captureallWhich auto-features to enable. CSV: context,network,performance,vitals,rage-clicks,breadcrumbs — or all / none.

Analytics (opt-in)

AttributeDefaultEffect
data-analyticsabsent → offWhat analytics features to enable. CSV: pageviews,spa,events,auto-events — or all / none.
data-analytics-id-storagelocalStorageWhere to persist visitor_id. Options: localStorage (per-origin), cookie (for cross-subdomain), memory (new ID each tab load).
data-analytics-domain(current host)Used only when id-storage="cookie". Set to .example.com to share visitor across subdomains.
data-analytics-respect-dntfalseWhen true, honors navigator.doNotTrack === "1" — disables all analytics. Logs continue.
data-analytics-time-on-pagefalseEmits a pageview_end event with duration_ms before SPA navigation or page close.
data-analytics-scrollfalseTracks max scroll % per page; included in pageview_end.
data-analytics-persist-userfalsePersists user_id set via Loguro.identify() in localStorage so it survives reloads.

Common configurations

Just pageviews, nothing else

<script
  src="https://app.logu.ro/loguro.js"
  data-api-key="brk_..."
  data-analytics="pageviews,spa"
></script>

Tracks initial pageview + SPA route changes. No custom events, no auto-events, no Web Vitals (those need data-capture="vitals").

Custom events only (app with manual instrumentation)

<script
  src="https://app.logu.ro/loguro.js"
  data-api-key="brk_..."
  data-analytics="events"
></script>

Loguro.track() works. No automatic pageviews. Use for app shells where you want explicit control.

Marketing site with full tracking + GDPR-friendly

<script
  src="https://app.logu.ro/loguro.js"
  data-api-key="brk_..."
  data-analytics="all"
  data-analytics-respect-dnt="true"
  data-analytics-time-on-page="true"
  data-analytics-scroll="true"
></script>

Everything on, honors Do-Not-Track, captures engagement signals.

Cross-subdomain (app + marketing share one visitor)

<script
  src="https://app.logu.ro/loguro.js"
  data-api-key="brk_..."
  data-analytics="all"
  data-analytics-id-storage="cookie"
  data-analytics-domain=".acme.com"
></script>

visitor_id is now in a cookie scoped to .acme.com, so www.acme.com and app.acme.com see the same visitor.

Self-hosted ingest

<script
  src="https://app.acme.com/loguro.js"
  data-api-key="brk_..."
  data-endpoint="https://ingest.acme.com"
  data-analytics="all"
></script>

All requests go to ingest.acme.com (/ for logs, /batch for events) instead of ingest.logu.ro.

Loading async or with defer

Both async and defer are safe. The SDK installs window.Loguro synchronously on execution; any track() calls made before the script loads will throw a ReferenceError. If you need to queue calls before load, wrap with a feature-detect:

<script>
  window._loguroQueue = window._loguroQueue || [];
  function track(...args) {
    if (window.Loguro) window.Loguro.track(...args);
    else window._loguroQueue.push(args);
  }
</script>
<script async src="https://app.logu.ro/loguro.js" data-api-key="brk_..." data-analytics="all"></script>
<script>
  window.addEventListener('load', () => {
    if (window._loguroQueue && window.Loguro) {
      window._loguroQueue.forEach((args) => window.Loguro.track(...args));
    }
  });
</script>

For most sites, simply placing the SDK script high in <head> (without async / defer) is enough.

CSP (Content-Security-Policy)

If you have CSP, you’ll need to allow:

script-src 'self' https://app.logu.ro;
connect-src 'self' https://ingest.logu.ro;

For self-hosted ingest, swap ingest.logu.ro for your domain.

Size & performance

  • 16 KB minified, ~5.7 KB gzip
  • Single file, single HTTP request, IIFE — no module dependencies
  • All listeners are passive where applicable; zero impact on scroll perf
  • Events buffer for up to 5 seconds before flushing, so initial page paint isn’t blocked by network

Next

// related

See also