Install guides (31)
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
onRenderBodyingatsby-ssr.js- Allowed domains
- Your own domain (set when you add the site)
- Time
- About 3 minutes
Steps
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:
<script src="https://useishara.com/w.js" data-site="pk_…" defer></script>
Create
gatsby-ssr.jsat the root of your project, or open it if you have one, and add the tag withonRenderBodyandsetPostBodyComponents. 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 />, ]); }Rebuild and deploy the site.
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. UsesetPostBodyComponents, notreplacePostBodyComponents: with the replace functions, the last plugin to call them wins. - Gatsby’s
<Script>component adds scripts after React hydrates by default, whilegatsby-ssr.jsputs the tag in the HTML of every page.
Next
Once reviewers leave notes, your coding agent can apply them. The widget’s options (language, position, colour, launcher) are in the docs.