Docs

Auto-Capture

One ~5 kB script tag (2 kB gzip) captures UI interactions automatically — page views, clicks, and form submissions — grouped into sessions, with no further code changes. Perfect for session context around your manually tracked events.

Setup

Add the script to your HTML and initialize it with your public key. Public keys are safe to ship in a page: they can only submit auto-capture events through POST /v1/events/batch and can never read activity, so an exposed key never leaks other users' data.

index.htmlstl_capture.js
<script src="https://softechlog.com/stl_capture.js"></script>
<script>
  Softechlog.init("stl_pk_xxxxxxxxxxxx", {
    // apiUrl: "https://api.softechlog.com", // override for staging
    // trackPageviews: true,                  // auto page views incl. SPA route changes
    // captureUrlQuery: false,                // keep ?query and #hash out of stored URLs
    // debug: false,                          // log to the console
  });
</script>
OptionDefaultDescription
apiUrlhttps://api.softechlog.comOverride the API base URL (staging, proxies)
trackPageviewstrueRecord ui.page_viewed on load and on pushState / replaceState / popstate route changes
captureUrlQueryfalseBy default query strings and fragments are stripped from stored URLs (?token=…, #access_token=…). Set true to keep them.
debugfalseLog activity to the browser console

Identify the current user

Call once on login or page load when the user is known. Events buffered before the call are attributed retroactively, and the identity persists for the tab session. Until then, events are stored without an actor:

app.jsidentify / reset
// After login (or on page load when the user is known):
Softechlog.identify({
  id: currentUser.id,             // required
  name: currentUser.name,         // optional
  email: currentUser.email,       // optional
  avatar_url: currentUser.avatar, // optional
});

// On logout: flush, forget the user, start a new session
Softechlog.reset();

What gets auto-captured

TriggerAction nameMetadata
Page view (incl. SPA route change)ui.page_viewedurl, title, referrer
Button clickui.button_clickedtext, selector, page_url
Link clickui.link_clickedtext, href, selector, page_url
Form submitui.form_submittedform_id, form_name, page_url

All auto-captured events are stored with capture_mode: "auto", so you can always separate them from server-tracked events when filtering.

Privacy controls

  • Form field values are never read — only structural metadata like form names and page URLs.
  • URLs are stored without query string or fragment unless you opt in with captureUrlQuery: true.
  • data-stl-ignore on an element (or any ancestor) skips it entirely; data-stl-mask keeps the event but redacts its text.
  • Element text is truncated to 200 characters.
index.htmldata-stl-ignore / data-stl-mask
<button data-stl-ignore>Not tracked at all</button>
<div data-stl-mask><button>Tracked, text redacted</button></div>

Sessions

The script generates a session id (a UUID) and attaches it to every event, so the API groups them into browsing sessions automatically. Each session records its starting page, start/end time, and event count — browse them in the dashboard under Sessions and replay a session's timeline, or fetch it yourself with GET /v1/events?session_id=…. Softechlog.reset() starts a fresh session on logout.

Delivery

  • Events are batched every 2 seconds (≤ 100 events / ≤ 48 KB per request), sent immediately when the tab is hidden, and via sendBeacon on unload.
  • Requests use text/plain with the public key in the JSON body, so no CORS preflight is needed from any origin.
  • Retries with exponential backoff on network errors and 5xx; honours Retry-After on 429; pauses for 5 minutes on 402 (monthly plan limit reached). The queue is capped at 500 events (oldest dropped).
  • Rate limit: 200 batch calls per minute per public key — batching keeps normal traffic far below this.

Manual tracking from the browser

For meaningful actions outside the auto-capture scope, you can also track custom events with the same script:

app.jstrack / page / flush
Softechlog.track('checkout.started', { plan: 'growth' }); // action must be resource.verb
Softechlog.page();                                         // manual page view (e.g. custom routers)
Softechlog.flush();                                        // send the queue now
Softechlog.sessionId;                                      // current session id (UUID)
Browser events count toward your monthly plan cap like any other event. If you need to read activity in the browser, use a feed token — never a secret key.