# Install

> Install atrby by pasting one script tag into the head of every page, with its data-site key and optional attributes.

Canonical: https://atrby.site/docs/setup
Last updated: 2026-10-21

## Add your site

Sign up and enter your domain. Subdomains such as `app.acme.io` and `docs.acme.io` are counted under it automatically. Each site gets a public key that starts with `st_`. You'll find it later in Site settings.

## Paste the script

Put this in the `<head>` of every page. It loads with `defer`, so it never blocks rendering.

*Any site*

```html
<script defer src="https://app.atrby.site/atrby.js" data-site="st_your_site_key"></script>
```

*Next.js · app/layout.tsx*

```tsx
import Script from "next/script";

export default function RootLayout({ children }) {
  return (
    <html lang="en">
      <body>
        {children}
        <Script defer src="https://app.atrby.site/atrby.js" data-site="st_your_site_key" />
      </body>
    </html>
  );
}
```

WordPress, Webflow, Shopify and Google Tag Manager: paste the same tag wherever the platform lets you add code to the head of every page.

**Single-page apps work as is.** The script records a pageview on every `history.pushState` and back/forward navigation, so React, Vue and Svelte routers need nothing extra.

## Options

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `data-site` | string | Required | Your site key. Nothing is sent without it. |
| `data-cookie` | "true" | Optional | Keep the same visitor across days with a first-party cookie. Only takes effect when the site is set to cookie mode. See [privacy modes](https://atrby.site/docs/privacy). |
| `data-autocapture` | "true" | Optional | Record clicks on links and buttons as a click event. Text that looks like an email or a long number is masked. |
| `data-api` | URL | Optional | Send events somewhere other than https://app.atrby.site/api/ingest, for example your own proxy. See [proxy](https://atrby.site/docs/proxy). |

## Allowed hostnames

Events are accepted from your domain and its subdomains. Anything else is dropped, so a copy of your snippet on someone else's site can't skew your numbers. To count a staging domain or a preview host such as `acme.pages.dev`, add it under Site settings → Extra allowed hostnames.

## Next

[Check it works](https://atrby.site/docs/verify), then [connect revenue](https://atrby.site/docs/revenue).

## Related
- [Check it works](https://atrby.site/docs/verify)
- [Overview](https://atrby.site/docs)
