Sumidatasumidata.io
Sign in
Docs/Getting started/Install the SDK
Getting started · 2 min

Install the SDK

Two ways in: a CDN <script> tag for any HTML page, or the @sumidata/browser npm package for bundled apps (Vite, Vike, React, Next.js). Pick the tab that matches your stack - every page view, click, and error is captured automatically.

01Add Sumidata

Pick your stack, add the snippet, and verify in a test environment.

index.html
<!-- Sumidata SDK -->
<script>
  window.Sumidata = window.Sumidata || { push: function(m, a) { (this.q = this.q || []).push([m, a, Date.now()]) } };
</script>
<script
  src="https://sdk.sumidata.io/loader.js"
  data-project-id="YOUR_PROJECT_ID"
  data-src="https://sdk.sumidata.io/sumidata.js"
  async
></script>
i
CDN or npm? The HTML tab loads a ~1 KB loader from sdk.sumidata.io - zero build tooling. The other tabs install @sumidata/browser, which bundles the SDK into your app - no external script and CSP-friendly. Both report to the same project.
1

Replace YOUR_PROJECT_ID

Find your project ID in the Dashboard under Settings → Projects, in the ID column. It's a UUID like 3f6c2a1e-8b4d-4e9a-9c1f-2d7b5e0a6c43.

2

Verify before publishing

Run the app locally or in an approved test environment with a separate Sumidata test project. The SDK starts recording as soon as it loads. Follow the verification steps to find a unique event from your app. Keep the test project ID in test configuration; use the intended target project for the production configuration. Publish only when that deployment is authorized and the repository workflow permits it.

The onboarding screen confirms the first event received by its selected project. Events sent to a separate test project do not confirm the target project, and a local check does not verify production. Next step: Identify users so sessions stitch to known accounts.

02Troubleshooting

If the SDK doesn't seem to load, check these.

Content Security Policy

Both installs send data to https://api.sumidata.io, so a strict CSP needs it in connect-src. The npm package bundles the SDK into your app, so there's no extra script origin to allow. If you use the CDN <script> tag, also add https://sdk.sumidata.io to script-src:

CSP header
Content-Security-Policy: script-src 'self' https://sdk.sumidata.io; connect-src 'self' https://api.sumidata.io;

Ad blockers

Some ad blockers match on the word analytics or on common vendor domains. Sumidata's loader domain is generic enough to pass most filters, but if you see 0 events, check the browser Network tab for a blocked request. The npm package avoids a blocked script - the SDK ships inside your own bundle - but it still sends data to api.sumidata.io, so a blocker that lists that domain stops it too.