Skip to content

Let an AI coding agent install Crustat

Copy a ready-made prompt with your own tracking line in it, paste it into your AI coding agent, and check the one file it changed.

When this helps

If you build your site with an AI coding agent, like Claude Code, Cursor or GitHub Copilot, you can hand it the install. Crustat writes the instructions for you, with your real tracking line already in them, so the agent knows exactly what to add and where.

Get the prompt

  1. In Crustat, open your site and go to Site settings → Install.
  2. Under Where does your domain run?, pick the AI agent tab.
  3. Click Copy the prompt. To read it first, click See the prompt.

The same prompt also appears on your site’s stats page while it’s waiting for its first visit.

What the prompt asks for

The prompt is in English in every language of the app, since agents follow English instructions best. It gives the agent your exact line and these rules:

  • Once, in the shared layout. Add the line in the template that renders <head> for every page, like index.html, a root layout, a base template or the theme header. Not page by page.
  • Exactly as it is. Don’t change the src or the data-site value, and keep defer.
  • A plain script tag is simplest. A framework’s own script component, like the one in Next.js, works too, as long as it keeps the same src and data-site.
  • No duplicates. If there’s already a Crustat line, replace it instead of adding a second one.
  • Rocket Loader and script combiners. If the site uses Cloudflare Rocket Loader, or a plugin that combines or delays scripts, add data-cfasync="false" or exclude the line from that plugin.
  • Content-Security-Policy. If the site sets one, allow https://stats.crustat.com in script-src and connect-src.

It ends by asking the agent to tell you which file it changed and to show you the line as it ended up.

Use it

  1. Open your project in your agent.
  2. Paste the prompt and send it.
  3. Read the agent’s answer. Check the file it names and the line it shows. The data-site value should match the Site ID on your Install page.
  4. Publish the change the way you usually do.

Check that it worked

Open your live site, not localhost, and wait about a minute. On Site settings → Install the badge changes from No visits yet to Working since and the day.

If it doesn’t change, ask the agent to show you where the line ended up in the built page, or check it yourself: view the page source of your live site and search for crustat. Then see visits aren’t showing up.

Using a framework?

For Astro and Next.js there are also ready-made packages. You can point your agent at them instead: Astro, Next.js. Either way works.

Still stuck? Write to hello@crustat.com.

All articles
The mascot waiting

Almost ready

We're opening to everyone soon.

Crustat is in its final checks before we open sign-ups. Leave your email and we'll write once, the day it opens, with your 14 days free waiting.

One email when we open. No newsletter. See our privacy page.