Install the widget with one script tag
One script tag for staging, a silent loader for the live site.
About 3 minutes · 5 steps · Get started
Open Website widget
Pick your website in the sidebar, then Website widget. The code on that screen has your project ID filled in.
Staging and preview sites: paste the script
Paste it before the closing body tag, or into a tag manager such as Zaraz (Custom HTML, all pageviews). The Feedback button is always visible, so use this on sites only your team and clients see.
Staging and previews <script src="https://app.margin-comments.com/widget.js" data-project="YOUR_PROJECT_ID" data-environment="staging" data-build="your-build-id" defer ></script>Live site: paste the reviewer-only loader instead
Visitors get nothing: no request and no button. The loader only fetches the widget in a browser that is in review mode.
Live site, reviewers only <script> (function (d) { var q = location.search + location.hash; if (!/(^|; )margin_review=1/.test(d.cookie) && !/[?&#](margin|margin_comment|margin_pair)=/.test(q)) return; var s = d.createElement("script"); s.src = "https://app.margin-comments.com/widget.js"; s.async = true; s.dataset.project = "YOUR_PROJECT_ID"; s.dataset.environment = "production"; s.dataset.mode = "review"; d.head.appendChild(s); })(document); </script>Enter review mode
Open the website from the dashboard once with Open website. The page opens already connected, and the browser stays in review mode for 30 days. Exit review mode in the widget ends it.
Check that it works
Reload the page. The Margin button appears. If it does not, the widget guide for missing buttons lists the usual causes.
Good to know
- Set data-environment to staging, production or preview, and data-build to your build or commit ID. Both show up on every comment.
- Never put an MCP token or a Cloudflare credential into your website. The widget needs only the project ID.
Next
- Leave a comment on an elementClick what you mean, and Margin keeps the page, element and device with it.
- The Margin button does not appearFive checks, in the order they usually explain it.
Back to the Help Center. No account yet?