Skip to content

Docs / Getting started

Install with AI

A ready prompt that lets Claude, ChatGPT, Cursor or Copilot install the Chatyol widget in your own codebase, the right way.

One prompt, any assistant

In Chatyol, Settings → Websites → Install → Copy AI prompt copies a prompt with your key and domain filled in. Paste it into Claude, ChatGPT, Cursor or Copilot inside your project and it adds the widget in the right file for your framework, then shows you the diff.

Each platform's step-by-step panel has its own copy of the prompt, focused on that platform.

What the prompt says

This is the prompt, with placeholders where Chatyol fills in your key and domain:

text
Install the Chatyol live chat widget on this website.

## The snippet
```html
<script src="https://cdn.chatyol.com/widget.js" data-key="pk_your_key" async></script>
```
- Public key: pk_your_key (safe to commit; it only works on pages of example.com and its subdomains).
- Load it ONCE for the whole site, as late as possible (end of <body>, async/defer). Never inside a component that re-renders or remounts.

## Where to put it (pick what this project uses)
- Plain HTML / static site: before </body> on every page, or in the shared footer/layout.
- React (Vite / Create React App): index.html (public/index.html for CRA), before </body>. Not in useEffect.
- Next.js App Router: app/layout.tsx with next/script, strategy="afterInteractive".
- Next.js Pages Router: the same <Script> in pages/_app.tsx.
- Vue (Vite): index.html before </body>. Nuxt 3: nuxt.config.ts → app.head.script.
- Angular: src/index.html before </body>.
- SvelteKit: src/app.html before </body>. Astro: the base layout, before </body>. Remix: app/root.tsx inside <body>.
- Laravel / Blade, Django, Rails, PHP: the main layout template before </body>.
- WordPress: wp_footer hook in a child theme's functions.php (or a header/footer plugin).
- Shopify: layout/theme.liquid before </body>.

## Content Security Policy (only if the site sends one)
Add these sources to the existing policy (don't replace it):
- script-src https://cdn.chatyol.com
- connect-src https://api.chatyol.com wss://api.chatyol.com
- img-src https://cdn.chatyol.com https://api.chatyol.com https://app.chatyol.com data: blob:

## Don't
- Don't add npm packages, iframes or wrappers; the single script is the whole integration.
- Don't copy widget.js into the project; always load it from https://cdn.chatyol.com.
- Don't add it twice.

## Optional: open or identify from code
```js
window.Chatyol?.open();                       // e.g. from a "Contact support" button
window.Chatyol?.identify({ name, email });    // logged-in users: prefills their details
```

## Check it works
1. Run or deploy the site on example.com and open any page: a chat bubble appears bottom right.
2. In the browser console, `typeof window.Chatyol` is "object".
3. On localhost the bubble still loads, but sending says "This chat isn't available on this site". That's expected.

When done, tell me which file you changed and show the diff.

Before you merge

Read the diff. The change should be one script tag in one layout file, plus a config value if your project keeps keys in config.

Something unclear or out of date? Email support@chatyol.com.