Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.tryproduck.com/llms.txt

Use this file to discover all available pages before exploring further.

Once the script loads, the widget exposes one global function:
window.produck(command, ...args)
Everything here is optional — the widget works fully with just the script tag.
CommandArgumentsWhat it does
identify{ userId?, email?, name? }Attach the current user’s identity to their feedback.
triggerOpen the widget from your own UI.
oneventName, callbackListen for submit or close.
destroyRemove the widget and its listeners from the page.

Identify your users

Tell Produck who’s giving feedback so each submission ties back to a real user instead of being anonymous. Call identify once you know who they are — typically right after login.
window.produck("identify", {
  userId: "user_123",
  email: "ada@example.com",
  name: "Ada Lovelace",
});
All three fields are optional — send whatever you have. If you need to identify a user before the script finishes loading, queue the call first. The widget replays anything queued the moment it boots, so nothing is lost:
<script>
  window.produck = window.produck || function () {
    (window.produck.q = window.produck.q || []).push(arguments);
  };
  window.produck("identify", { userId: "user_123" });
</script>

<script src="https://tryproduck.com/sdk/v1.js" data-project="pk_live_YOUR_KEY" defer></script>

Open the widget from your own UI

Wire up your own “Give feedback” button with trigger:
document.querySelector("#feedback-button").addEventListener("click", () => {
  window.produck("trigger");
});

Listen for events

React when a user submits or dismisses the widget — for example, to show a thank-you toast.
window.produck("on", "submit", () => {
  showToast("Thanks for the feedback!");
});

window.produck("on", "close", () => {
  // user dismissed the widget without submitting
});
EventFires when
submitThe user successfully submits feedback.
closeThe user closes the widget without submitting.

Clean up on logout

Call destroy to remove the widget when a user’s session ends. On shared devices, this keeps the next user from seeing the previous one’s identity.
window.produck("destroy");