# Install the script

> Serve the Numbat tag from your own subdomain, so ad blockers do not drop visitors and returning visitors are recognized.

Numbat is one script tag in your page template. Serve it from a subdomain
you own, such as `data.example.com`. It takes one DNS record and is
included in every plan.

Can't change DNS today? Use the [standard tag](#if-you-cannot-change-dns-today)
now and switch later.

## Why your own subdomain

The standard tag loads from Numbat's shared domain. From your own
subdomain:

- Ad blockers don't drop your visitors.
- Safari recognizes visitors when they come back.

Numbat runs the certificate and the server. There is nothing to host.

## Before you begin

- Access to your domain's DNS settings.
- Access to your site's `<head>` or page template.

## 1. Add your subdomain

1. In Numbat, open **Property > Script**.
2. In the **Your own domain** card, type a subdomain such as
   `data.example.com` and choose **Add domain**.

   Pick a neutral name, not one that says Numbat. A bare domain such as
   `example.com` won't work.

The card now shows the DNS record to add.

![The Your own domain card in Numbat for data.example.com, marked Waiting for your DNS record, with the CNAME record to add: the name data.example.com and the target customers.ironbarkedge.com, each with a Copy button, and a note for Cloudflare users](../../../assets/docs/numbat/script-custom-domain-record.png)

## 2. Add the DNS record

1. Open the DNS settings where your domain is managed. That is usually
   where you bought it, or Cloudflare if you use it.
2. Delete any other record on the same name, such as an A record.
3. Add a CNAME record.

   ```text
   Type    CNAME
   Name    data
   Target  customers.ironbarkedge.com
   ```

   Type only `data` in the name field. Most providers add your domain
   for you.
4. On Cloudflare, set **Proxy status** to **DNS only** (gray cloud).

Numbat checks every minute. The card usually switches to **Serving your
code** within a few minutes, sometimes up to an hour. You can close the
page.

| Provider | Name field | Target field |
|---|---|---|
| Cloudflare | Name | Target |
| GoDaddy | Name | Value |
| Namecheap | Host | Value |
| Squarespace Domains | Name | Data |
| Wix | Host Name | Value |
| Hostinger | Name | Target |
| IONOS | Hostname | Points to |
| Porkbun | Host | Answer |
| Amazon Route 53 | Record name | Value |
| Vercel | Name | Value |

On Hostinger, turn off Hostinger CDN for the subdomain.

## 3. Add the tag

1. When the card shows **Serving your code**, choose **Copy code**.

   ![The Your own domain card in Numbat for data.example.com, marked Serving your code, with the new script tag, a Copy code button and a Change domain button](../../../assets/docs/numbat/script-custom-domain-serving.png)

2. Paste the tag into the `<head>` of every page. On most sites, that is
   the shared page template.

   ```html
   <script defer src="https://data.example.com/<your-site-id>.js"></script>
   ```

3. Deploy.

Replacing the standard tag? Swap it for this one. There is no gap in
data.

## If you cannot change DNS today

1. Open **Property > Script**. Under **Standard**, choose **Copy code**.

   ![The Standard card in Numbat, with the script tag and a Copy code button below it](../../../assets/docs/numbat/script-standard-code.png)

2. Paste it into the `<head>` of every page and deploy.

   ```html
   <script defer src="https://go.ironbarkedge.com/<your-site-id>.js"></script>
   ```

Ad blockers drop some visitors with this tag. Switch to your own
subdomain when you can, with steps 1 to 3 above.

## Check that it works

On **Property > Script**, the status reads **You're live** within about a
minute of your first visit.

In your browser's developer tools, the script and its `/e` requests should
load from your subdomain.

## What to know

- The same tag works on every domain you approve.
- Single-page apps need nothing extra. A new history entry counts as a
  page view.
- Pasting the tag twice is harmless.
- Each site can have up to 2 custom domains.
- Safari limits the cookie to 7 days, even on your own subdomain. Numbat
  bridges the gap with a token in the page's storage.

## Troubleshooting

### The card stays on "Waiting for your DNS record"

1. Check the record against the one in the card. Look for a doubled name
   such as `data.example.com.example.com`.
2. On Cloudflare, set the record to DNS only. A Proxied (orange cloud)
   record never works.
3. Check that the record is at the DNS host your nameservers point to.
   That may not be your registrar. `dig NS example.com +short` shows
   where that is.
4. Check that no other record uses the same name.
5. Wait. Some providers take up to 48 hours.

On Wix and IONOS, the record only works while the domain uses their
nameservers.

### The record works, but the certificate never arrives

Your domain probably has CAA records. Add ones that allow
`letsencrypt.org`, `pki.goog` and `ssl.com`. A CAA record on a parent
domain counts too.

### The card shows "Could not verify"

Numbat stops checking after 7 days. Remove the domain, fix the record and
add it again.

## Next steps

- [Approve your domains](/docs/tracking/approve-your-domains)
- [Tag your ads](/docs/tracking/tag-your-ads)
- [Content Security Policy](/docs/tracking/content-security-policy), if
  your site sets one.
