Widgets & EmbedsCustom Trigger

Custom Trigger

Attach the ProductBridge widget to any element on your page — your own button, nav item, or menu link. The default floating button is hidden; the widget opens only when your trigger element is clicked.

Overview

The custom trigger embed hides the default floating button and connects the widget to an element of your choosing. When a user clicks your element — a nav link, a help button, a keyboard shortcut handler — the widget opens. Everything else works the same: popup or sidebar mode, user identification, all tabs.

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 HTML with a unique ID
  2. Load the SDK and call ProductBridge.init() with trigger set to that element's CSS selector
  3. The floating button is suppressed — only your element opens the widget

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',
        trigger: '#feedback-btn', // CSS selector of your element
        mode: 'popup',            // or 'sidebar'
        theme: 'auto',
        defaultTab: 'feedback',
      });
    };
    document.head.appendChild(s);
  })();
</script>

Trigger Any Element

The trigger option accepts any valid CSS selector. You can target an existing element anywhere 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',
    trigger: '#nav-feedback-link',
  });
</script>
// Or open programmatically from anywhere — no trigger element needed
document.getElementById('my-help-menu-item')
  .addEventListener('click', () => ProductBridge.open());

Configuration Options

OptionTypeDefaultDescription
organizationIdstringRequired. Your organization ID
triggerstringRequired. CSS selector of the element that opens the widget
modestringpopuppopup or sidebar
themestringautoauto, light, or dark
defaultTabstringfeedbackfeedback, roadmap, or changelog
userTokenstringJWT for automatic user identification — see Identity Verification

When trigger is set, the SDK suppresses the default floating button entirely. The widget only opens when your trigger element is clicked, or when you call ProductBridge.open() programmatically.

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.