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

# Setup

> Set up analytics in your extension and website.

Install the analytics library:

```bash theme={null}
pnpm add @crxbase/analytics
```

Add the alarms permission to your extension manifest:

```json theme={null}
{
  "permissions": ["alarms"]
}
```

If your manifest already has a permissions list, add `alarms` to it.

The library has separate extension and website entry points. Both use the same crxbase project ID. Initialize the extension entry point in your background script:

```typescript theme={null}
import { analytics } from "@crxbase/analytics/extension";

analytics.init({
  projectId: "YOUR_PROJECT_ID",
  welcomeUrl: "https://example.com/extension/welcome",
  uninstallUrl: "https://example.com/extension/goodbye",
});
```

The uninstall URL is optional. If you already have an uninstall page, you can use that page. See [Uninstall reporting](https://docs.crxbase.com/analytics/uninstall.md).

Initialize the website entry point on your landing and welcome pages:

```typescript theme={null}
import { analytics } from "@crxbase/analytics/web";

analytics.init({ projectId: "YOUR_PROJECT_ID" });
```

On the welcome page, call `analytics.attributeInstall()` after initialization. The extension integration supports Chrome extensions using Manifest V3.


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