formbricks/formbricks

[BUG] on-the-fly triggers do not work with displayPercentage

Closed this issue · 1 comments

Issue Summary

When you use an on-the-fly URL trigger the survey does not take the displayPercentage into account.
The issue is that renderWidget is called for inline triggers: https://github.com/formbricks/formbricks/blob/main/packages/js/src/lib/noCodeActions.ts#L63

suggestion: I know this might be a bit late, but I think a different architecture for inlineTriggers would be better:

  1. Add an attribute inline to ActionClass. If inline is true, do not show it in the Actions & Attributes panel in the backend and exclude from action search.
  2. Add an option to the survey editor to add a trigger, these actions will be inline (but only visible for this survey).
  3. The sync API should return inline actions just like normal actions.
    This has the following advantages: a) every feature for reusable action will also work for inline actions and vice versa and b) it reduces complexity and reduces file size of the frontend pixel.

Steps to Reproduce

  1. Add survey, set displayPercentage to 1%, set URL on-the-fly trigger.
  2. Open targeted page.
  3. Survey pops up.

Expected behavior

expected:
Survey pops up in 1% of page loads.

actual:
Survey pops up in 100% of page loads.

Other information

No response

Screenshots

No response

Environment

Desktop (please complete the following information)

- js 1.6.4

hey @jonas-hoebenreich - thanks for flagging this, we'll look into it a ship a fix asap