# CrawlConsole -- Lovable Install Guide

This is the Lovable-safe shortcut for [`INSTALL.md`](/INSTALL.md).

## Phase 1: show the claim link first

Lovable default: assume the human has no CrawlConsole account, property, project
key, tracking key, or credentials.

Before the human has clicked a CrawlConsole claim link and replied `claimed`:

- Do not open Lovable **Cloud -> Secrets**.
- Do not show an **Add secrets** form or inline secret-entry card.
- Do not ask for `CRAWLCONSOLE_PROJECT_KEY`.
- Do not ask for `CRAWLCONSOLE_TRACKER_KEY`.
- Do not add code that references CrawlConsole credentials.
- Do not inspect missing secrets by opening a Lovable secrets dialog.

Connect to the no-account installer MCP endpoint:

```txt
https://mcp.crawlconsole.com/install-analytics
```

Call `create_install_session` with the target site URL plus these hints:

```json
{
  "runtimeProfile": "cloudflare-worker",
  "installerClient": "lovable",
  "hostHint": "lovable"
}
```

The Lovable response is intentionally claim-link-only. It returns `claimUrl`,
`sessionId`, and `sessionSecret`, but it does not return key values, env
snippets, or anything that should be entered into Lovable secrets yet.

Show the returned `claimUrl` in Lovable chat immediately. Directly under the
claim link, write exactly:

```txt
After you claim it, reply here with "claimed"; I will open Lovable Cloud ->
Secrets so you can add the project key and tracking key shown on the
CrawlConsole page.
```

Then stop and wait. Do not open **Cloud -> Secrets** and do not continue to the
tracking-code phase until the human replies `claimed`.

## Phase 2: after the human replies claimed

As soon as the human replies `claimed`, perform a Lovable UI action: open
Lovable **Cloud -> Secrets** and show Lovable's native **Add secrets**
popup/form. This is the first time the secrets UI should be opened.

Do not show a chat prompt, inline question card, or chat input asking the human
for credentials. The credentials must be entered in Lovable's native
**Add secrets** popup/form, not in chat.

The next visible interaction after `claimed` must be the native Lovable secrets
UI. Do not answer with a credential-entry request in chat. Do not render a code
block or fill-in template in chat.

Pre-fill or create exactly these two secret names in the Add secrets form:

```txt
CRAWLCONSOLE_PROJECT_KEY
CRAWLCONSOLE_TRACKER_KEY
```

Configure the open Lovable Add Secrets popup exactly like this:

| Secret name                | CrawlConsole credentials page value |
| -------------------------- | ----------------------------------- |
| `CRAWLCONSOLE_PROJECT_KEY` | project key                         |
| `CRAWLCONSOLE_TRACKER_KEY` | tracking key                        |

If you need to send a short chat note after the popup is open, use only this:

```txt
I opened Lovable Cloud -> Secrets. Use the CrawlConsole page you kept open to
fill the two CrawlConsole secret values, then save.
```

Do not prefix either secret with `VITE_`. Keep `CRAWLCONSOLE_TRACKER_KEY`
server-side only.

If Lovable cannot open **Cloud -> Secrets** automatically, tell the human to
open Lovable **Cloud -> Secrets** manually and stop. Do not collect the
credentials in chat.

## Phase 3: install and verify

After the claimed credentials are saved, use
**Install Path A: Cloudflare Workers / TanStack Start / Lovable** from
[`INSTALL.md`](/INSTALL.md).

Install tracking in the Worker `fetch` handler, commonly `src/server.ts`.
Do not put the tracker key or tracking endpoint call in browser code. Publish
or run the app, then call `verify_installation` with the `sessionId` and
`sessionSecret` from Phase 1.
