Guides

How to Integrate SnagRelay Widget into an HTML Website

Add a bug reporting widget to any HTML site with one script tag: the element, requests, console logs and session replay, with no framework.

How to Integrate SnagRelay Widget into an HTML Website

Overview

Integrating SnagRelay into a static HTML website is straightforward. With just a few lines of JavaScript, you can add a powerful bug reporting widget that captures the element the user points at, requests with bodies, console errors and a session replay automatically, plus a screenshot the reporter can mark up.

Prerequisites

  • A SnagRelay account (sign up free)
  • Your SnagRelay API key (shown on your project's Install step)
  • Access to edit your HTML files

Installation

Add the Script to Your HTML

Add the following code just before the closing </body> tag of your HTML file:

<script>
    window.onSnagRelayLoad = function (api) {
        api.init();
    };
    var script = document.createElement('script');
    script.defer = 1;
    script.src = 'https://app.snagrelay.com/widget/load/YOUR_API_KEY?onload=onSnagRelayLoad';
    document.getElementsByTagName('head')[0].appendChild(script);
</script>

Replace YOUR_API_KEY with your actual API key from the SnagRelay dashboard.

Verify Installation

After adding the script:

  1. Open your website in a browser
  2. Look for the SnagRelay feedback button (usually in the bottom-right corner)
  3. Click it to test the bug reporting flow

That's It!

The widget configuration (position, colors, button text, etc.) is managed in your SnagRelay dashboard. Any changes you make there will automatically apply to your widget.

Best Practices

  • Load asynchronously — The defer attribute ensures the widget doesn't block page load
  • Add to all pages — Include the script in your main template or layout file
  • Test in staging first — Verify the integration works before deploying to production

Troubleshooting

Widget not appearing?

  • Check browser console for JavaScript errors
  • Verify your API key is correct
  • Ensure the script is loaded (check Network tab in DevTools)
  • Check for CSS conflicts that might hide the widget

Next Steps

Once installed, you can:

  • Customize the widget appearance in your dashboard settings
  • Connect a tracker (Jira, Linear, GitHub, GitLab, Trello or Azure DevOps), or keep reports in the SnagRelay inbox
  • Connect your coding agent over MCP: Cursor, Claude Code or Codex
  • Invite your team members

Further Reading

After install

What you get after install

Every report arrives in your inbox or tracker with the evidence already attached:

  • The element

    What the reporter pointed at: label, component and selector. Errors tied to it are outlined in red.

  • Console and JS errors

    With file and line, captured up to the moment of the report.

  • Network requests

    Status, URL and request and response bodies, failed and successful.

  • Session replay

    The moments leading up to the bug, with repro steps.

  • Environment

    URL, browser, OS and viewport, plus the screenshot. On paid plans, also video.

Optional

Connect your agent

Add the SnagRelay MCP server once, then paste a prompt that tells your agent to call get_issue_context. After you review the fix, mark_issue_resolved emails the reporter. MCP is on every plan.

https://mcp.snagrelay.com/v1

Add this URL as a remote MCP server, then click Allow. Paste a prompt that tells the agent to call get_issue_context, then mark_issue_resolved only after you have reviewed the fix.

More articles

Fix bugs with Cursor, Claude Code or Codex

Send your agent the whole bug, not a screenshot.

Add one script tag. Every report reaches your agent over MCP with the element, the console error and the failing request.

Start free, connect my agent

Free plan. No card. Set up in minutes.

See the agent flow