> ## Documentation Index
> Fetch the complete documentation index at: https://docs.manalens.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Install

> Add the ManaLens Web SDK to your website or app with an HTML snippet or npm, then verify the first event.

## Create a project

1. Sign in to the ManaLens dashboard and create a workspace.
2. Create a project and enter your site domain. The collector accepts browser events only from this domain and its subdomains.
3. Open the project's installation instructions. They show your **Publishable key** and a snippet that is ready to copy.

> [!NOTE]
>
> The Publishable key is safe to ship in a page or a game build. It sends website and game events. [Server events](https://docs.manalens.dev/sdks/server.md) need a separate [Secret key](https://docs.manalens.dev/api/authentication.md#secret-key). Never put a Secret key or an [API key](https://docs.manalens.dev/api/authentication.md#api-keys) in the browser.

## Install the SDK

> [!NOTE]
>
> **Early access.** The Web SDK is available on request during early access. The package is not on the npm registry yet and the repository is private until launch. To ask for the browser bundle and the package archive, use the Contact page of the ManaLens website (`/contact`).

> [tab] HTML snippet
>
> The HTML snippet works on any website, including WordPress, Webflow, Shopify and static sites. Copy the snippet from the setup page and add it to the `<head>` of every page:
>
> ```html theme={null}
> <script
>   src="SCRIPT_URL_FROM_THE_SETUP_PAGE"
>   data-publishable-key="YOUR_PUBLISHABLE_KEY"
>   data-endpoint="https://YOUR_COLLECTOR_ENDPOINT"
>   defer
> ></script>
> ```
>
> When the setup page shows a pinned jsDelivr build, it also adds `integrity` and `crossorigin="anonymous"`. Keep both attributes. The browser then refuses a file that has changed. See [Subresource Integrity](https://docs.manalens.dev/security/sri.md).
>
> After the script loads, the instance is available as `window.untitledAnalytics`:
>
> ```js theme={null}
> window.untitledAnalytics?.track('signup_completed', { plan: 'starter' });
> ```
>
> Optional attributes:
>
> | Attribute | Effect |
> | - | - |
> | `data-cross-subdomain="false"` | Keep the visitor ID cookie on the current host only. By default it is shared across subdomains. |
> | `data-require-consent="true"` | Start in [consent mode](https://docs.manalens.dev/guides/consent.md). |
> | `data-auto-pageviews="false"` | Send no automatic page views. Call `window.untitledAnalytics.page()` yourself, for example on Astro's `astro:page-load`. See [client routing](https://docs.manalens.dev/sdks/web.md#single-page-apps-and-client-routing). |
> | `data-debug="true"` | Print SDK logs in the browser console. |
>
> See all [snippet attributes](https://docs.manalens.dev/sdks/web.md#snippet-attributes).

> [tab] npm
>
> For React, Next.js and other bundled apps, use the `@untitled-analytics/web` package:
>
> ```bash theme={null}
> npm install @untitled-analytics/web
> ```
>
> > [!NOTE]
> >
> > The package is not on the npm registry yet. Install the `.tgz` package archive that you received (`npm install ./untitled-analytics-web-<version>.tgz`). If you have access to the repository, you can also build the archive with `pnpm install && pnpm build && pnpm pack`.
>
> Create one instance in your browser entry point:
>
> ```ts theme={null}
> import { createAnalytics } from '@untitled-analytics/web';
>
> const analytics = createAnalytics({
>   publishableKey: 'YOUR_PUBLISHABLE_KEY',
>   endpoint: 'https://YOUR_COLLECTOR_ENDPOINT',
> });
>
> analytics.track('signup_completed', { plan: 'starter' });
> ```
>
> For Next.js, React and other single-page apps, see [single-page apps and client routing](https://docs.manalens.dev/sdks/web.md#single-page-apps-and-client-routing).

## Track key actions

The SDK tracks page views for you. Add a [custom event](https://docs.manalens.dev/sdks/web.md#track-custom-events) for each action you want to measure, and [identify users](https://docs.manalens.dev/guides/identify-users.md) after login:

```ts theme={null}
analytics.track('signup_completed', { plan: 'pro' });
await analytics.identify('user_123', { email: 'user@example.com', plan: 'pro' });
```

## Verify the installation

1. Open your site with the browser developer tools open.
2. Confirm that the script loads once and that `POST /v0/events` returns `202`.
3. In the dashboard, click **Verify Installation** on the setup page. The project activates when it receives its first event.
4. Open [Activity](https://docs.manalens.dev/features/activity.md). Your page view appears after a short delay.

> [!TIP]
>
> If an ad blocker blocks the requests, serve the SDK through your own domain with a [reverse proxy](https://docs.manalens.dev/guides/reverse-proxy.md).

## Next steps

> [card] [Web SDK reference](https://docs.manalens.dev/sdks/web.md)
>
> Options, methods and single-page app routing.

> [card] [Server events](https://docs.manalens.dev/sdks/server.md)
>
> Send events from your backend.

> [card] [Consent mode](https://docs.manalens.dev/guides/consent.md)
>
> Store nothing until the visitor gives consent.

> [card] [Reverse proxy](https://docs.manalens.dev/guides/reverse-proxy.md)
>
> Avoid ad blockers.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.