> ## Documentation Index
> Fetch the complete documentation index at: https://docs.nocknock.cloud/llms.txt
> Use this file to discover all available pages before exploring further.

# How to Install the NOCK Feedback Widget on Your Site

> Add a single script tag to your site to activate the NOCK feedback widget. Works with any framework or plain HTML in under five minutes.

Installing NOCK on your website takes a single script tag. No build step, no npm package, no framework-specific plugin required — paste the snippet before your closing `</body>` tag and the widget button appears automatically. This page shows you exactly where to find the snippet, what each attribute does, and how to place it correctly in common frameworks.

## Find the snippet in your Dashboard

Every project has its own ready-to-copy snippet. To find it:

1. Open your project from the **Projects** list.
2. Go to **Settings → Widget**.
3. Click **Copy Snippet** — the full script tag is copied to your clipboard with your real project token already filled in.

## The widget script tag

The snippet you copy from the Dashboard looks like this:

```html theme={null}
<script
  src="https://nocknock.cloud/widget/nock.js"
  data-token="YOUR_PROJECT_TOKEN"
  data-api-base="https://nocknock.cloud"
></script>
```

Replace `YOUR_PROJECT_TOKEN` with the token shown in your project's **Settings → Widget** screen (or just copy the pre-filled snippet — it's already correct).

### Script tag attributes

| Attribute       | Required | Description                                                                               |
| --------------- | -------- | ----------------------------------------------------------------------------------------- |
| `src`           | Yes      | The URL of the NOCK widget script. Do not change this value.                              |
| `data-token`    | Yes      | Your unique project token. This tells NOCK which project inbox to send feedback to.       |
| `data-api-base` | No       | The NOCK API endpoint. Defaults to `https://nocknock.cloud` — leave this value unchanged. |

<Note>
  Additional configuration options — such as button position, colour, and which data-capture features to enable — are managed from the Dashboard under **Settings → Widget**. You don't need extra attributes in the script tag to use them.
</Note>

## Placing the snippet

<Steps>
  <Step title="Open your site's global layout or HTML template">
    The snippet must load on every page where you want the widget to appear. In most setups this means your global layout file, your base HTML template, or a shared footer component.
  </Step>

  <Step title="Paste the snippet before the closing body tag">
    Place the script tag as the last element inside `<body>`, immediately before `</body>`. Loading it here ensures your page content renders first and the widget doesn't block any other scripts.

    ```html theme={null}
    <!-- Your page content -->

    <script
      src="https://nocknock.cloud/widget/nock.js"
      data-token="YOUR_PROJECT_TOKEN"
      data-api-base="https://nocknock.cloud"
    ></script>
    </body>
    ```
  </Step>

  <Step title="Save and deploy">
    Save the file and deploy or restart your site as you normally would. The widget loads on every page that includes the snippet.
  </Step>
</Steps>

## Framework tips

NOCK works with any framework that renders HTML. Here are the most common placement patterns:

| Framework / Setup               | Where to add the snippet                                                                     |
| ------------------------------- | -------------------------------------------------------------------------------------------- |
| Plain HTML                      | Inside the `<body>` of every HTML file, or a shared `footer.html` partial                    |
| React (Create React App / Vite) | `public/index.html`, before `</body>`                                                        |
| Next.js                         | `app/layout.tsx` (App Router) or `pages/_document.tsx` (Pages Router), inside the `<body>`   |
| Nuxt.js                         | `app.vue` or a layout file, using a `<script>` tag via `useHead` or directly in the template |
| Astro                           | A global layout component, inside the `<body>` slot                                          |
| WordPress                       | Theme's `footer.php`, before `</body>` — or use a header/footer plugin                       |
| Webflow                         | **Project Settings → Custom Code → Footer Code**                                             |
| Shopify                         | `theme.liquid`, before `</body>`                                                             |

<Tip>
  If your framework uses server-side rendering, the widget script loads on the client automatically — no special `"use client"` directive or dynamic import is needed. NOCK's script is fully self-contained.
</Tip>

<Warning>
  Don't place the snippet inside a component that conditionally renders or unmounts. If the script tag is removed from the DOM after loading, the widget button will disappear. Always add it to a persistent layout that is present on every page.
</Warning>

## What's next?

Your widget is installed. Now open your live site and confirm the button appears and feedback flows through correctly.

<Card title="Test Your Widget" icon="circle-check" href="/getting-started/test-your-widget">
  Send a test ticket and verify everything is working end to end.
</Card>
