# Analytiics quickstart

Two minutes to a first pageview. Pick whichever of the three routes matches how
your site is built.

## 1. The script tag

```html
<script defer src="https://in.analytiics.co/script.js" data-site="example.com"></script>
```

That is the whole install. It records the initial pageview, SPA navigation
through the History API, back/forward, outbound link clicks, and flushes on page
hide. The snippet defaults to the hosted collector. Localhost is ignored unless
you set `data-dev="true"` (or `allowLocalhost` for the module), so development
traffic never lands in production data.

Serving the script from your own domain instead is one line different and
can avoid script-host blocklists. The collector still defaults to
`https://in.analytiics.co`; optionally set `data-api` to a first-party collector proxy:

```html
<script defer src="/script.js" data-site="example.com" data-api="https://in.analytiics.co"></script>
```

## 2. As a module

```ts
import { init } from "@analytiics/tracker";

const analytiics = init({ site: "example.com", api: "https://in.analytiics.co" });
analytiics.track("page_published", { template: "grid" });
analytiics.identify(user.id);
```

## 3. Let the CLI do it

```sh
npx analytiics start
```

Signs you in with a device code, creates the project, issues a server write key
and writes it to `.env`, scaffolds `analytics.yaml`, and installs the
`instrument` agent skill. Every step is idempotent, so running it again is a
status check rather than a second setup. See [the CLI page](/docs/cli).

## Verify it

```sh
curl -s https://in.analytiics.co/health
```

Then open your site and watch the dashboard at `https://www.analytiics.co/p/example.com`.
A live example, on real traffic, is at [/p/thiings](/p/thiings).

## What comes next

- Declare your events in [analytics.yaml](/docs/manifest) so they are reviewed
  as a diff and typed at the call site.
- Send revenue from your backend with the
  [Node SDK](/docs/sdk) — the browser path deliberately cannot.
