How to add an AI chatbot to Nuxt

On Nuxt, a chat widget is installed through nuxt.config.ts, under app.head.script. Applies on your next build and deploy. None.

Where it goes

nuxt.config.ts, under app.head.script

Availability: None.

Adding the chatbot to Nuxt

  1. 1

    Open nuxt.config.ts.

  2. 2

    Add an entry to app.head.script with the src and defer set.

  3. 3

    Set body: true so it renders at the end of <body> rather than in <head>.

  4. 4

    Rebuild and deploy.

  5. 5

    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 Nuxt

  • Configuring it in nuxt.config keeps the tag out of components and out of hydration.

  • In SSR mode the tag is server-rendered, so there is no flash before the launcher appears.

Nuxt questions

Where does the code go on Nuxt?
nuxt.config.ts, under app.head.script. Applies on your next build and deploy.
Do I need a paid Nuxt plan?
None.
Will a Nuxt update remove it?
Configuring it in nuxt.config keeps the tag out of components and out of hydration.
Does it slow Nuxt 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 Nuxt 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.