# Add the Cortad page tag to your site

Add one script tag to your pages to see what people did around each answer your AI gave, with a recording of what they saw.

## Add the tag

Put it once in the page every person uses.

```html
<script src="https://b.cortad.com/i/cortad.js" data-key="ct_pub_..." async></script>
```

The value is `CORTAD_PUBLIC_KEY`, which the setup on **Your users** writes into your env file beside your SDK key and prints in the tag line for your page. The key is public and carries no secret. Name the addresses your site answers on in Settings, under **Where your pages send from**, so a page on any other address is refused.

If your app's backend answers on another host than the page, name it on the tag with `data-backends="api.example.com"`, or under **Backend hosts** in Settings.

## What you get

- What the person did around each request to your app, such as clicking the same spot three times within a second, or clicking something that did nothing.
- A recording of what they saw.

## Keep something out

Recording is on from the moment the tag is in.

| To do this | What happens |
| --- | --- |
| Add the class `cortad-no-capture` | The element is an empty box of its size in a recording. |
| Add the class `cortad-mask` | The element's text is masked in a recording. |
| Add the class `cortad-sensitive` | A click on the element sends none of its words, labels or address. A click on an element inside it sends that element's own words, so the class goes on the element that carries them. |
| Turn on **Mask all text** in Settings | Every word on the page becomes stars in the recording. The layout stays. |
| Turn off **Record what people see** in Settings | Nothing is recorded. |

## Say who the person is

Once your page knows who is signed in, say so:

```js
window.cortad.identify("your own id for them");
```

The visit they are on, and every later visit from that browser, is then theirs.

On sign-out, for a machine more than one person uses:

```js
window.cortad.forget();
```

A page your server renders for a signed-in person can name them on the tag instead, with `data-who`.

## Show who they are

**Your users** shows each user as a number, User 37, in the order they first came. To see who they are instead, pass a label as you identify them: `window.cortad.identify(user.id, { label: user.email })`, or on the server `cortadClient.run({ id, user: customerId, label: customer.email }, ...)` (`label=` in Python). The label can be an email, a name or your own id for them. Only people on your Cortad account see it; your coding agent sees the number.

## Ask for consent first

A page that must ask first adds `data-opt-out-by-default` to the tag, and calls one of these when the person answers:

```js
window.cortad.optIn();
window.cortad.optOut();
```

Until a yes, the tag sends nothing the person does and records nothing. Recording starts on the first page loaded after the yes.

With `data-respect-dnt`, the tag does nothing in a browser that has Do Not Track or Global Privacy Control on.

## Mark a good ending

When the person reaches what your product is for, such as a checkout or a booking, say so:

```js
window.cortad.outcome("checkout");
```
