Widget reference
One script, about 18 kB compressed, rendered in a Shadow DOM so it can't clash with your styles.
Script attributes
| Attribute | Description |
|---|---|
data-project | Required. Your project key (pk_…). It's public; requests are only accepted from the addresses listed on the project. |
data-api | Optional. Override the API origin (defaults to wherever embed.js is served from). |
JavaScript API
Add your own “Give feedback” button, for example in a staging banner:
JavaScript
// Start comment mode (the user then clicks an element)
window.Suggestra?.comment();
// Show the team sign-in card
window.Suggestra?.connect();Keyboard and URL shortcuts
Ctoggles comment mode,Esccancels.#suggestrain the URL shows the team sign-in card.#suggestra-thread=<id>opens a specific comment (used by “Open on page” and emails).
Single-page apps
Client-side navigation (history.pushState, replaceState, back/forward) is detected automatically, and comments for the new page are loaded. Comments are grouped by path, ignoring the query string and hash.
How pins stay attached
Each comment stores a stable CSS selector (preferring data-testid and real ids, skipping generated class names), an XPath, the element's text and its position. If the markup changes, the widget tries each in turn. If nothing matches, the pin shows where it was and is marked as moved; teammates can click Move pin and then click the right spot. Adding data-suggestra="hero-cta" to important elements makes anchoring bulletproof.
What gets captured with a comment
- Page URL (without the hash), viewport size, device pixel ratio, browser, language and timezone.
- A screenshot of the visible viewport with the pin drawn on it, uploaded after the comment is posted.
- The element's HTML (form field values are masked) and a few computed styles.
- The last 20 console errors and failed network requests since the page loaded.
Nothing is captured for visitors who aren't reviewing. Screenshots show whatever was on screen, so avoid reviewing pages with sensitive data, or hide it on staging.
Content-Security-Policy
If your site sends a CSP header, allow:
CSP directives
script-src https://suggestra.dev
connect-src https://suggestra.dev <your screenshot storage origin>
img-src https://suggestra.dev data: