# Add testimonials to a Nuxt site

> Collect and show customer testimonials in Nuxt with SiteBackend - load the script from nuxt.config, add a small component, and it works with nuxt generate.

Source: https://sitebackend.com/docs/testimonials/nuxt · Updated: 2026-11-19

Add SiteBackend testimonials to a Nuxt site with a placeholder `div` and one script. It works with `nuxt generate` and server rendering alike, because everything loads in the visitor's browser.

Get the IDs from your site's **Testimonials** tab in the dashboard: **Collect** for the form customers fill in (`c_…`), and **Widgets** for the wall, carousel, highlight or badge that shows approved ones (`w_…`).

## Load the script once

```ts title="nuxt.config.ts"
export default defineNuxtConfig({
  app: {
    head: {
      script: [{ src: "https://sitebackend.com/widget.js", async: true }],
    },
  },
});
```

To load it only on some pages, call `useHead` in those pages instead:

```vue
<script setup lang="ts">
useHead({ script: [{ src: "https://sitebackend.com/widget.js", async: true }] });
</script>
```

## Add a component

```vue title="components/Testimonials.vue"
<script setup lang="ts">
defineProps<{ id: string }>();
</script>

<template>
  <div :data-sitebackend-widget="id" />
</template>
```

Use it anywhere:

```vue title="pages/index.vue"
<template>
  <main>
    <h2>What our customers say</h2>
    <Testimonials id="w_YOUR_WIDGET_ID" />

    <h2>Leave a testimonial</h2>
    <Testimonials id="c_YOUR_COLLECT_ID" />
  </main>
</template>
```

## Client-side navigation

When a visitor follows a `NuxtLink`, Nuxt changes the page without reloading it. The script notices widgets on the new page and loads them, so you don't need to do anything.

## Local development

Widgets work on `localhost:3000` even when your site has a **domain** set in the dashboard: `localhost` and `127.0.0.1` are always allowed. Preview or staging addresses on other domains are blocked, though. See [sites](https://sitebackend.com/docs/getting-started/sites).

For a contact form on the same site, see [add a contact form to a Nuxt site](https://sitebackend.com/docs/forms/nuxt).
