For the complete documentation index, see llms.txt. This page is also available as Markdown.

In-App Message Event Listener

This feature is supported in React SDK version 11.37.0 and above.

Interfaces

HackleInAppMessageListener

interface HackleInAppMessageListener {
  beforeInAppMessageOpen?(inAppMessage: HackleInAppMessage): void
  afterInAppMessageOpen?(inAppMessage: HackleInAppMessage): void
  beforeInAppMessageClose?(inAppMessage: HackleInAppMessage): void
  afterInAppMessageClose?(inAppMessage: HackleInAppMessage): void
  onInAppMessageClick?(
    inAppMessage: HackleInAppMessage,
    view: HackleInAppMessageView,
    action: HackleInAppMessageAction
  ): boolean
}

onInAppMessageClick

You can control In-App Message behavior through the boolean value returned by the onInAppMessageClick method.

  • Returning true overrides the existing In-App Message action.

    • For example, if the existing In-App Message click action was Do not show for a day, that action will not execute.

  • Returning false keeps the existing In-App Message action as-is.

HackleInAppMessage

  • Returns the key of the In-App Message.

HackleInAppMessageView

  • You can directly close the In-App Message from within a listener function by calling close().

HackleInAppMessageAction

property
description

close?.hideDurationMillis

When the action hides the message for a specific duration, returns that duration in milliseconds.

link?.url

Returns the link when a link is included. e.g) https://hackle.io

link?.target

NEW_TAB when navigating to a new tab NEW_WINDOW when navigating to a new window CURRENT when navigating in the current tab

link?.shouldCloseAfterLink

Returns true when the close after link option is ON.

Usage Example

Register Listener

The example is written inside useEffect, but you can place it wherever it suits your use case.

Unregister Listener

Last updated