---
title: "Web SDK — Install & CDN"
description: "Install the browser SDK via CDN, self-host, and verify ingest."
collection: "guides"
slug: "web-sdk-install"
url: "https://naiza.ai/docs/guides/web-sdk-install"
markdown: "https://naiza.ai/docs/guides/web-sdk-install.md"
full_docs: "https://naiza.ai/docs.md"
product: "Naiza"
base_url: "https://api.naiza.ai/api/v1"
---

# Web SDK — Install & CDN

> Install the browser SDK via CDN, self-host, and verify ingest.

## Table of contents

- [1. Script tag — Naiza CDN (recommended)](#1-script-tag-naiza-cdn-recommended)
- [2. Direct download (self-hosted)](#2-direct-download-self-hosted)
- [3. Privacy & sampling](#3-privacy-sampling)
- [4. Verify on another origin](#4-verify-on-another-origin)
- [5. CDN & versioning](#5-cdn-versioning)
- [Related](#related)

Load the Naiza browser SDK via script tag from the official Naiza CDN, or bundle it directly from the release asset. Confirm endpoint and auth mode with your deployment — see [Web SDK API](https://naiza.ai/docs/api-reference/websdk.md).

## 1. Script tag — Naiza CDN (recommended)

Files are served from `sdk.naiza.ai`, a dedicated GCS-backed CDN. Pin a specific version for production stability. The `latest` path always resolves to the most recent release.

```html
<!-- Pinned version (recommended for production) -->
<script
  defer
  src="https://sdk.naiza.ai/v0.9.0/naizawebsdk.umd.js"
  crossorigin="anonymous"
></script>

<!-- Always-latest (suitable for development / staging) -->
<script defer src="https://sdk.naiza.ai/latest/naizawebsdk.umd.js"></script>
```

Use `defer` so execution starts after HTML parse. The UMD bundle exposes `NaizaWebSdk` on `window`.

```html
<script defer src="https://sdk.naiza.ai/v0.9.0/naizawebsdk.umd.js"></script>
<script>
  async function boot() {
    await NaizaWebSdk.init({
      token: "<MINTED_WEBSDK_JWT>",
      sdkSessionId: "ws_checkout_123",
      endpoint: "https://api.naiza.ai/api/v1/collect",
    });
  }
  if (document.readyState === "loading") {
    document.addEventListener("DOMContentLoaded", boot);
  } else {
    boot();
  }
</script>
```

Canonical `/api/v1/collect` uses `Authorization: Bearer` with a short-lived JWT minted server-side from `POST /api/v1/websdk/tokens`.

## 2. Direct download (self-hosted)

Download the bundle from the [GitHub Releases page](https://github.com/limazifyLab/naizaWebSDK/releases) and host it yourself if you need to serve it from your own domain.

```bash
# Download a specific release
curl -L https://github.com/limazifyLab/naizaWebSDK/releases/download/v0.9.0/naizawebsdk.umd.js \
  -o naizawebsdk.umd.js
```

## 3. Privacy & sampling

- `consent: false` — no network requests are sent (GDPR opt-out). Local collection still runs so data is available if consent is later granted.
- `sampleRate` — optional 0–1 fraction to reduce upload volume. Suppressed batches are discarded.
- Per-collector opt-out via `disabledCollectors` or `collectorConfig`.

## 4. Verify on another origin

1. Use a staging HTML page or a throwaway static deploy.
2. Load a pinned CDN URL, open DevTools → Network and confirm `POST` returns 2xx with `Authorization: Bearer`.
3. Toggle `consent: false` and confirm zero requests to the ingest host.

The SDK repo includes `examples/cdn-smoke-test.html` for quick end-to-end checks.

## 5. CDN & versioning

Every tagged release in the `naizaWebSDK` repository automatically publishes the UMD bundle to `sdk.naiza.ai/v{VERSION}/`. Versioned URLs are immutable and cached permanently. The `latest/` path is updated on every release with a short cache TTL (5 minutes). Check [sdk.naiza.ai/manifest.json](https://sdk.naiza.ai/manifest.json) for available versions.

## Related

- [Web SDK API](https://naiza.ai/docs/api-reference/websdk.md)
- [Authentication](https://naiza.ai/docs/api-reference/authentication.md)
- [Getting Started](https://naiza.ai/docs/guides/getting-started.md)

## Related documentation

- [Overview](https://naiza.ai/docs/guides/overview.md) — Base URL, authentication, decision types, risk scores, and rate limits.
- [Getting Started](https://naiza.ai/docs/guides/getting-started.md) — Make your first Naiza API call and verify your integration.
- [Tenant Onboarding](https://naiza.ai/docs/guides/tenant-onboarding.md) — Create tenants, invite operators, and configure webhooks.
- [Quick Start](https://naiza.ai/docs/guides/quick-start.md) — Common operations for events, decisions, lists, and feedback.
- [Event Monitoring](https://naiza.ai/docs/guides/event-monitoring.md) — Model product events and turn rule outcomes into decisions.
- [AML Integration](https://naiza.ai/docs/guides/aml-integration.md) — Screen customers and counterparties against AML watchlists.
- [Integration Examples](https://naiza.ai/docs/guides/integration-examples.md) — Node.js, Python, cURL, and webhook handler examples.
- [Best Practices](https://naiza.ai/docs/guides/best-practices.md) — Production guidance for keys, idempotency, and enforcement.

---

*Source: [https://naiza.ai/docs/guides/web-sdk-install](https://naiza.ai/docs/guides/web-sdk-install) · Full docs: [https://naiza.ai/docs.md](https://naiza.ai/docs.md)*
