Dynamic Controls & Advanced Usage

Dynamic Controls & Advanced Usage

Bugsnap provides a suite of programmatic controls that allow developers to dynamically interact with the widget after its initialization. This advanced usage ensures that the Bugsnap widget can adapt to various scenarios and user states on your website.

Showing and Hiding the Widget

Control the visibility of the Bugsnap widget on-demand.

To Show the Widget:

window._bugsnapWidget("event", "showWidget");

To Hide the Widget:

window._bugsnapWidget("event", "hideWidget");

Setting the Widget Position

Dynamically adjust the position of the Bugsnap widget on your webpage.

Example:

window._bugsnapWidget("event", "setPosition", "right");

Replace "right" with your desired position value ("left", "centre", or "right").

Setting Website User Details

Associate bug reports with specific users on your platform by setting the current user's details programmatically.

Example:

window._bugsnapWidget("event", "setCurrentUser", {
  current_user_id: "12345",
  current_user_email: "user@example.com",
});

Replace the placeholders with the appropriate user ID and email values.

Setting Feedback Message

Update the feedback message that users see after submitting a report, dynamically.

Example:

window._bugsnapWidget("event", "setUserFeedback", {
  user_feedback_title: "Thank you for the update!",
  user_feedback_body: "We appreciate your continuous feedback.",
});

Replace the placeholders with your desired feedback title and body.


These dynamic controls offer a higher degree of flexibility and adaptability for your Bugsnap integration. If you have any questions or need further assistance, don't hesitate to reach out to our support team at support@bugsnap.io.