How to add an AI chatbot to SvelteKit

On SvelteKit, a chat widget is installed through src/app.html, before %sveltekit.body% closes. Applies on your next build and deploy. None.

Where it goes

src/app.html, before %sveltekit.body% closes

Availability: None.

Adding the chatbot to SvelteKit

  1. 1

    Open src/app.html.

  2. 2

    Paste the snippet just before the closing </body> tag, after the %sveltekit.body% placeholder.

  3. 3

    Rebuild and deploy.

  4. 4

    Applies on your next build and deploy.

The snippet you paste

<script src="https://rubyrep.com/rubyrep.js" data-rubyrep="rr_your_public_key" defer></script>

Your own key replaces rr_your_public_key — you get it after training RubyRep on your site.

Worth knowing on SvelteKit

  • app.html is the shell for every route, so the widget survives client-side navigation.

  • Adding it in a +layout.svelte instead risks re-injection on navigation.

SvelteKit questions

Where does the code go on SvelteKit?
src/app.html, before %sveltekit.body% closes. Applies on your next build and deploy.
Do I need a paid SvelteKit plan?
None.
Will a SvelteKit update remove it?
app.html is the shell for every route, so the widget survives client-side navigation.
Does it slow SvelteKit down?
No measurable effect. The snippet is deferred, so it loads after your page has rendered, and the chat interface itself is only fetched when a visitor opens it.

Related

Get your snippet.

Enter your SvelteKit site and RubyRep reads it, builds your representative, and hands you the exact line to paste.

https://

Takes about a minute. No credit card.

Using something else? See all platforms.