Widgets & EmbedsCustom Trigger

Custom Trigger

Open the ProductBridge widget from any element on your page — your own button, nav item, or menu link. Initialize with customTrigger and call ProductBridge.toggle() from your element's click handler.

Overview

The custom trigger embed hides the default floating button and lets you open the widget from your own UI. Initialize the SDK with customTrigger: true, then call ProductBridge.toggle() (or ProductBridge.open()) from any click handler — a nav link, a help button, a keyboard shortcut. The widget opens as a full-height sidebar panel.

Use this when you already have a feedback entry point in your UI and don't want two buttons on screen.

How It Works

  1. Add any clickable element to your page
  2. Load the SDK and call ProductBridge.init() with customTrigger: true — this hides the floating button
  3. Wire your element's click event to ProductBridge.toggle()

Installation

<!-- 1. Your custom trigger element — can be any HTML element -->
<button id="feedback-btn">Share Feedback</button>

<!-- 2. Paste before </body> -->
<script>
  (function () {
    var s = document.createElement('script');
    s.src = 'https://app.productbridge.io/sdk/pb-widget.js';
    s.async = true;
    s.onload = function () {
      ProductBridge.init({
        organizationId: 'YOUR_ORGANIZATION_ID',
        customTrigger: true,      // hides the floating button
        theme: 'auto',
        defaultTab: 'feedback',
      });

      // 3. Wire your element to the widget
      document.getElementById('feedback-btn')
        .addEventListener('click', function () {
          ProductBridge.toggle();
        });
    };
    document.head.appendChild(s);
  })();
</script>

Trigger Any Element

You can wire the widget to any existing element on the page — you don't need to render a new button:

<!-- Trigger an existing nav link -->
<a id="nav-feedback-link" href="#">Feedback</a>

<script>
  ProductBridge.init({
    organizationId: 'YOUR_ORGANIZATION_ID',
    customTrigger: true,
  });

  document.getElementById('nav-feedback-link')
    .addEventListener('click', function (e) {
      e.preventDefault();
      ProductBridge.toggle();
    });
</script>
// Or open and close explicitly instead of toggling
document.getElementById('my-help-menu-item')
  .addEventListener('click', () => ProductBridge.open());

Configuration Options

OptionTypeDefaultDescription
organizationIdstringRequired. Your organization ID
customTriggerbooleanfalseRequired for this embed type. Set to true to hide the floating button; you open the widget yourself with ProductBridge.toggle() or ProductBridge.open()
themestringautoauto, light, or dark
defaultTabstringfeedbackfeedback, roadmap, or changelog
userTokenstringJWT for automatic user identification — see Identity Verification

With customTrigger: true, the SDK hides the floating button entirely and the widget opens as a sidebar panel. It opens only when you call ProductBridge.toggle() or ProductBridge.open() from your own code.

Identify Your Users

To link feedback to your logged-in users, generate a JWT on your backend and pass it as userToken. See Identity Verification for server-side code in Node.js, Python, PHP, Ruby, and Go.