Skip to main content
PBX Widgets creates widgets for experiments and personalizations built in the new personalization builder. You don’t write the HTML, CSS, or JavaScript yourself. Instead, you describe the widget, and PBX generates the component. This approach enables marketers, product managers, and conversion rate optimization (CRO) specialists to build UI components quickly without technical expertise. Typical widgets created with PBX include:
  • Newsletter subscription popups
  • Promotional banners
  • Exit-intent offers
  • Lead capture forms
  • Product recommendation panels
  • Survey or feedback modals
PBX widgets don’t support legacy personalization. Contact your Customer Success Manager if you need access to the new personalization builder.

Create a widget

Follow these steps to generate and refine a widget using PBX.

1. Open PBX

To start generating a widget in the Kameleoon interface:
  1. Go to Studio > Widgets.
  2. Click New widget.
  3. Select Using a prompt.
  4. Enter the required information in the pop-in menu.
  5. Click Create.

2. Write a prompt

Describe the widget you want to build in the prompt field. PBX uses this description to generate the widget UI automatically. If your prompt tracks a goal, create the goal first. Example prompt:
PBX newsletter popup preview on a demo shop page, with an AI chat that has just removed the left image panel

3. Preview and iterate

Review the generated widget and refine it with follow-up prompts, such as:
  • “Make the CTA button larger”
PBX preview of the newsletter popup with an enlarged Subscribe now button after the prompt 'make the CTA button twice bigger'
  • “Change the background color to a darker beige”
PBX preview of the newsletter popup with a darker beige background after the prompt 'make the background a darker beige'
  • “Make the popup appear after 3 seconds”

4. Edit the widget’s code

Edit a generated widget’s JS or CSS code directly, instead of refining it through prompts.
  1. Click the code icon in the header to open the View code tab.
  2. Click Edit code.
  3. Edit the widget’s JS or CSS code.
PBX code view of the Sticky offer banner styles version with JS code, Edit code button, and the AI chat panel
If you generate multiple versions of the widget, select the one you want to edit from the Selected version dropdown. You can edit only the last version. For older versions, you can view and copy the code, but you can’t edit it.

5. Add goals

Track visitor interactions (such as email submissions, button clicks, form completions, or widget displays) by adding goals to your prompt.
You must create the goals before you can track them in a PBX widget.
Example prompts for goals:
  • Newsletter signup: Track a goal called "Newsletter Signup" when the user clicks the Subscribe button.
  • CTA click: Track a goal when the CTA button is clicked. Goal name: Promo CTA Click
  • Widget engagement: Track a goal when the popup is displayed. Goal name: Widget Viewed

Generate an accessible version of your widget (optional)

Generate accessible version is in beta and available for selected customers only.
PBX can generate a version of your widget that complies with the WCAG 2.1 AA accessibility standard.
  1. Open the menu on a PBX version.
  2. Select Generate accessible version. PBX shows which accessibility rules it applies to the widget.
  3. PBX creates a new version of the widget and lists every change it made.

Collect widget responses in Kameleoon (optional)

If your widget asks visitors a question, such as an NPS score or a feedback comment, you need a way to gather those answers without setting up an external tool like Google Sheets. PBX detects when a widget contains a question or input and lets you collect the resulting responses directly in Kameleoon (in beta), then export them as a CSV file.

1. Enable response collection

When PBX generates a widget that contains a question or input, it prompts you to choose whether to collect the responses.
  1. In the Collect widget responses? prompt, select an option:
    • Yes, collect responses via Kameleoon: Kameleoon collects each response and makes it available for CSV export.
    • No, don’t collect responses: Kameleoon doesn’t collect widget response data.
  2. Click Apply.
Collect widget responses prompt with Yes and No options and an Apply button

2. Name the widget fields

Kameleoon uses the widget field names as the column headers in the exported CSV file, so give each field a clear, descriptive name.
  1. Open the Widget response settings panel.
  2. Review the automatically generated field names, listed as Field 1, Field 2, and so on.
  3. Hover over a field name and click the pencil icon to edit it.
  4. Enter a name, then click the checkmark to confirm or the cancel icon to discard the change.
  5. Click Apply to save your changes.
Widget response settings panel with the Widget field names list and Apply button
Apply isn’t available until you make at least one change to a field name.

What’s included in the export

Kameleoon exports responses collected through a PBX widget under the same conditions as survey CSV exports. The exported file includes:
  • Response timestamps
  • Visitor code
  • Answers per question
  • Campaign and variation details

Send widget responses to Google Sheets (optional)

To send survey and form responses from a PBX widget to Google Sheets, first configure your Google Sheet as described in Send survey responses to Google Sheets. When writing the prompt to connect your widget to Google Sheets, follow these guidelines:
  1. Define a clear submission trigger: Specify which element triggers the request. The trigger is typically the main CTA button (for example, SubmitButton).
  2. Use an external HTTP POST request: Set the method to POST and include your Google Apps Script Web App URL.
  3. Provide the Web App URL explicitly: Always include the full URL (for example, https://script.google.com/macros/s/XXXXXXXX/exec). PBX can’t infer or generate this automatically.
  4. List all elements to send: Explicitly name every field (for example, email, rating, comment).
  5. Match parameter names exactly: Ensure the names match exactly across your widget element names, the request payload, and the Google Sheets column headers.
Don’t rely on implicit behavior. PBX requires exact field names.
Example prompt for Google Sheets integration:

Write effective prompts

Well-written prompts significantly improve the quality of the generated widget.

Use a clear structure

Effective prompts follow a logical structure:
Example:

Be specific

Specific prompts produce more accurate layouts and styles. Bad prompt: Create a popup for a newsletter Better prompt: Create a centered modal popup for newsletter subscription with a modern ecommerce design. Include an email input field and a large CTA button offering 15% off.

Define UI elements explicitly

Always specify the elements you need, such as titles, buttons, inputs, secondary links, icons, or images. Example:

Describe behavior

PBX can generate widget logic if you specify it. Examples:
  • Show popup after 5 seconds
  • Close popup when clicking outside
  • Close popup when clicking "No thanks"

Iterate instead of rewriting

Rather than rewriting the entire prompt, refine your widget step-by-step. Iterative prompting improves results efficiently. Examples:
  • Make the CTA button darker
  • Increase padding inside the popup
  • Add rounded corners to the input field

FAQ

PBX widgets and AI-generated widgets have different editing requirements:
  • PBX widgets: Use natural language to create these widgets. You can only edit them within the PBX interface. You can’t open or edit PBX widgets in the Widget Studio.
  • AI-generated widgets (Widget Studio): When you use the Create with AI feature in the Widget Studio, Kameleoon uses standard Widget Studio elements. You can edit these widgets manually in the Widget Studio. You can’t open or edit these widgets in PBX.