How the DeepSync SDK works

What the tracking script actually does once it's on your page, and what it costs you.

Getting started

DeepSync captures behavior through a small JavaScript SDK (built on rrweb) that records DOM mutations, clicks, scrolls, and page views, then batches them to the ingestion API. React Native and Flutter packages ship the same event model for mobile apps.

The loader tag

Every web install is the same one-line tag. The /t/{projectId}.js loader resolves your organization, ingest URL, and SDK config server-side, then pulls the versioned SDK bundle — so you only ever need to know your public project ID, and SDK upgrades reach you without a code change on your side.

html
<!-- DeepSync tracking snippet -->
<script async src="https://ingest.deepsync.in/t/YOUR_PROJECT_ID.js"></script>
Paste before </head> on every page.

How data leaves the browser

  • Events flush every 500ms or once 10 events queue up, whichever comes first.
  • A full DOM snapshot forces an immediate flush, since replay can't render without it.
  • On page unload, DeepSync uses navigator.sendBeacon so the last batch isn't lost.
  • Flushing pauses automatically while the tab is idle, to save the visitor's bandwidth.

Single-page apps

The SDK patches the History API, so client-side route changes in React, Vue, Angular, Svelte, and every router built on them are recorded as page views automatically. You do not need to call anything on navigation.

The SDK resolves visitor geolocation with a client-side fallback lookup if your server doesn't supply it — no action needed, but worth knowing if you're auditing third-party network calls from your site.

Calling deepsync() before the loader finishes

The loader is async, so an inline script that fires early (an e-commerce purchase event, for example) may run first. Add the command-queue stub above your loader tag and those calls are buffered and drained once the SDK boots.

html
<script>
  window.deepsync = window.deepsync || function () {
    (window.deepsync.q = window.deepsync.q || []).push(arguments);
  };
</script>
Optional — only needed if your own code calls deepsync() from inline scripts.

Related

Still have a question?

Support is included on every plan, including Free. Tell us what you're trying to do and we'll point you at the right page — or fix the docs.

Contact support