New: AI voice-to-issue in 5 secondsSee how it works

CDN setup

JavaScript API

Set reporter context and open, close, show, or hide the widget from your website.

The CDN script installs window.snappa. Call its methods after the script has loaded.

Reporter and report context

window.snappa.setUser({
  id: "user-123",
  email: "user@example.com",
  name: "Jane Doe",
  image: "https://example.com/avatar.png",
});

window.snappa.setEnvironment("production");
window.snappa.setCustomMetadata({
  plan: "team",
  page: "billing",
});

setUser() replaces the current reporter data. setCustomMetadata() replaces the metadata object; include every value you want attached to later reports.

MethodBehavior
setUser(user)Set reporter fields: id, email, name, and image.
clearUser()Clear the current runtime reporter data.
setEnvironment(environment)Set the environment label.
clearEnvironment()Clear the current runtime environment override.
setCustomMetadata(metadata)Set custom string metadata.
clearCustomMetadata()Clear the current runtime custom metadata override.

Control the widget

window.snappa.showWidget(); // Show the trigger only
window.snappa.hideWidget(); // Hide the trigger only
window.snappa.open("screenshot");
window.snappa.close(); // Close the report dialog; leave the trigger visible

open() reveals the trigger if it is hidden and opens the selected report flow. Its mode is optional and defaults to "simple". Supported modes are:

  • "simple"
  • "screenshot"
  • "video"
  • "speak"
  • "select-element"

close() closes the dialog without hiding the trigger. showWidget() and hideWidget() only affect trigger visibility; they do not open or close the dialog.

Example: open from your own button

<button type="button" onclick="window.snappa.open('screenshot')">
  Report a problem
</button>

For initial values configured in the script tag, see Data attributes.