useWidgetSubmitAction

The useWidgetSubmitAction hook is designed to enable the tracking of Widget Submitted analytics events and manage the widget interaction submit action. It internally calls createWidgetInteractionAction to ensure analytics tracking is executed upon successful resolution.

Example usage

It returns an object with the onInteractionSubmit function that you can use to handle the submission of widget interactions.

const { onInteractionSubmit } = useWidgetSubmitAction({ widgetId: "<Widget ID>" });

Hook Argument

widgetId

TypeDefault
String (Required)No Default

Hook Return Value

onInteractionSubmit

Type
Function of type: ({ interactionItem:WidgetCreateInteractionActionArg }) => Promise<void | IWidgetInteraction>

interactionItem: The item representing the interaction with the widget.