SnagFrog
Compare Guides Docs Privacy Terms Sign in

Web widget reference

Last updated 12 October 2026

The widget is one script tag. It adds a report button to a website and opens a form that attaches the page, browser and recent console errors. This page lists everything it accepts; the website guide walks through a first setup.

<script src="https://snagfrog.com/widget.js" data-app="your-app" async></script>

Options

Options are data- attributes on the script tag. The app's Install tab has a configurator that writes them.

AttributeDefaultWhat it does
data-apprequiredYour app's slug.
data-color#2669e8The button's colour (hex).
data-labeltranslated "Report a bug"The button's text.
data-buttonshown"none" hides the button; open the form yourself with Snag.open().
data-icon-onlyoffA round button; the label becomes its tooltip.
data-iconfrog"chat", "bug", "idea", "question", "megaphone", "none", or an https image address.
data-sizemd"sm", "md" or "lg" button.
data-radiuspopup 16, button a pillCorner radius in pixels, 0 to 32, for the popup and the button.
data-positionright"right" or "left".
data-offset-x, data-offset-y20Distance from the corner in pixels.
data-z-index2147483000The button and popup's stacking order.
data-layoutform"form" (every field on one screen), "composer" (one message box), "guided" (one question at a time) or "home" (a welcome screen with a row per kind of report).
data-kindsbug,feedback,questionWhich kinds of report to offer.
data-kindnoneThe kind selected when the form opens.
data-popup-colorthe app's colourThe colour used inside the popup (hex).
data-titlethe app's nameThe popup's header.
data-avatarnoneAn https image for the header.
data-greetingnoneAn opening message in the chat layouts.
data-width, data-height440 × 720Popup size on desktop, in pixels: width 320 to 640, height 400 to 900.
data-themeauto"auto", "light" or "dark".
data-langthe page's <html lang>, else EnglishOne of the 17 supported languages, for example "de".
data-hotkeynoneA keyboard shortcut such as "alt+b" or "mod+shift+k" (mod is ⌘ on a Mac, Ctrl elsewhere).
data-consoleon"off" stops keeping console errors for reports.
data-page-urlpath"path" (no query string or fragment), "full" or "none".
data-errorsoff"auto" sends uncaught errors and unhandled rejections on their own.
data-versionnoneYour app's version, attached to captured errors.
data-keynoneThe app's publishable key (snag_pk_…), for apps set to accept only errors that carry it.

JavaScript API

CallWhat it does
Snag.open(options?)Opens the form. { kind, title, description, context } fill in fields; any other key is added to the context.
Snag.close()Closes the form.
Snag.show() / Snag.hide()Shows or hides the button.
Snag.identify({ email, name })Who is reporting: fills in their name and email.
Snag.setContext({ key: value })Details attached to every report from this page.
Snag.on(event, fn) / Snag.off(event, fn)Listen for "open", "close" or "submit".

Calls made before the script has loaded can be queued, and the same line works afterwards:

window.Snag = window.Snag || { q: [] };
Snag.q.push(["identify", { email: user.email, name: user.name }]);

Your own buttons

Any element with data-snag-open opens the form when clicked. data-snag-kind, data-snag-title and data-snag-description fill in the form, and data-snag-source lands in the report's context so those reports are easy to filter.

What is kept private

  • Console errors stay in the page until someone sends a report. Before they leave it, addresses in them lose their query string and anything that looks like a token is redacted.
  • A home folder in a file path becomes ~.
  • The page address is sent without its query string unless you set data-page-url="full".
  • Captured errors never include the query string, whatever data-page-url says.

Content-Security-Policy

The widget uses no inline scripts and no eval. A page with a policy needs:

script-src  https://snagfrog.com   (the script)
frame-src   https://snagfrog.com   (the report form)
img-src     https://snagfrog.com   (the button icon; plus your own host for a custom icon)
connect-src https://snagfrog.com   (only with data-errors="auto")

Questions

How big is the widget script?

The script every page loads holds only the button, the API and the error hooks. The popup, the hotkey handling and the sending code load on demand: when the button is hovered or pressed, Snag.open() is called, a hotkey is set, or an error is to be sent.

What does the widget send without the user doing anything?

Nothing by default. Console errors are kept in the page and only attached when someone sends a report. With data-errors="auto", uncaught errors and unhandled promise rejections are sent on their own, at most ten distinct ones per page load.

Does the page address include the query string?

Not by default. data-page-url is "path" unless you change it: the address without its query string or fragment. "full" sends the whole address and "none" sends none.

More reference pages

  • MCP server reference
  • Errors API reference
  • Changelog reference
  • Webhooks, Discord and Slack

Start a free 30-day trial · All docs · Guides · Compare with other tools · Changelog

SnagFrog by Karakabakov Privacy · Terms · DPA