# Add Ishara to Gatsby

Add the feedback widget to a Gatsby site with setPostBodyComponents in gatsby-ssr.js, which adds the tag to every page Gatsby builds.

- Where it goes: `onRenderBody` in `gatsby-ssr.js`
- Allowed domains: your own domain
- Time: about 3 minutes

## Steps

1. In Ishara, open **Sites → your site → Install** and copy the line under **Add the line to your site**. Your site’s key is already in it:

```html
<script src="https://useishara.com/w.js" data-site="pk_…" defer></script>
```

2. Create `gatsby-ssr.js` at the root of your project, or open it if you have one, and add the tag with `onRenderBody` and `setPostBodyComponents`. Gatsby calls it for every page it renders, and the tag goes at the end of `<body>`:

```
import * as React from "react";

export function onRenderBody({ setPostBodyComponents }) {
  setPostBodyComponents([
    <script key="ishara" src="https://useishara.com/w.js" data-site="pk_…" defer />,
  ]);
}
```

3. Rebuild and deploy the site.
4. Open your site. Back on the **Install** page, **Check it’s live** turns into **The widget is live** as soon as the widget loads. Then open the **Reviewer link** from the same page: only people who open it see **Leave a note**.

## Good to know

- If the file already exports `onRenderBody`, add the call to it rather than a second function. Use `setPostBodyComponents`, not `replacePostBodyComponents`: with the replace functions, the last plugin to call them wins.
- Gatsby’s `<Script>` component adds scripts after React hydrates by default, while `gatsby-ssr.js` puts the tag in the HTML of every page.

Checked against the official docs on 2026-11-12: [Gatsby: gatsby-ssr.js](https://www.gatsbyjs.com/docs/reference/config-files/gatsby-ssr/), [Gatsby: Script component](https://www.gatsbyjs.com/docs/reference/built-in-components/gatsby-script/).
