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

In-App Message JavaScript Bridge

JavaScript Bridge is a tool for the HTML in-app message and Hackle's SDK to interact with each other.

  • When a close button is clicked

  • When navigating to a link

  • When an action corresponding to a campaign conversion is performed

  • When a Hackle feature call is needed within the in-app message

In these situations, you can use JavaScript Bridge to control user behavior tracking, URL navigation, and in-app message display.

hackleBridgeReady

When Hackle.bridge becomes available in the HTML, the hackleBridgeReady event is published. It is recommended to access Hackle.bridge inside the callback of that event listener.

Access to Hackle.bridge must always occur after the Ready event has been fired.

Example

<button id="hackle-url">
	Go to Hackle
</button>
<script>
  window.addEventListener("hackleBridgeReady", function(){
    document.querySelector("#hackle-url").addEventListener("click", function(e) {
      Hackle.bridge.openUrl("https://hackle.io");
    });
	})
</script>

Opening a URL

Opens the URL in the browser of the device where the in-app message is displayed and closes the in-app message.

  • Supports deep links.

  • Does not track click events.

target
Description

CURRENT

Open in the current page

NEW_TAB

Open in a new tab

NEW_WINDOW

Open in a new window

Example

Opens the URL in the current page and closes the in-app message.

Open in new tab and close in-app message

Open in new window and close in-app message

Personalization

In in-app message HTML, you can display personalized messages using user information and event information.

Querying User Properties

Queries the properties of the user that triggered the message.

Example

Querying the Trigger Event

Queries the information of the event that triggered the in-app message. It includes the event key, value, and the full list of properties.

Example

Querying a Trigger Event Property

Queries a single property of the event that triggered the in-app message.

Example

User Behavior Tracking

Tracking Clicks

You can track click events corresponding to conversions in an in-app message campaign.

The $in_app_action event is triggered, and based on this event, you can check campaign performance in the Hackle Dashboard.

Example

elementId added as $in_app_action event property

When a link click itself is considered a conversion, handle opening the URL and collecting the link click event simultaneously.

Example

Event Tracking

Sends an event. Same as the method for sending events in the JavaScript SDK.

Example

Closing an In-App Message

Closes the in-app message.

hideDuration
Description

true

Hide for one day

false

Close immediately

number

Hide for the number of minutes passed

null / undefined

Close immediately

Example

Get started quickly with the HTML in-app message template.

We provide HTML In-App Message Templates that you can use immediately with copy-paste.

Last updated