If you integrated using the Widget Loader, please reference the legacy Widget Loader Configurations guide.
Integrate using an iFrame
Follow these steps to integrate a widget on a website using an iFrame.1
Request a Widget URL
Create a backend endpoint that calls the Platform API to generate a widget URL. Set the value of
widget_type to your desired widget:- Insights Widget:
pulse_widget - Mini Insights Widget:
mini_pulse_carousel_widget - Micro Insights Widget:
micro_pulse_carousel_widget
2
Create an iFrame
Create an iFrame using the widget’s recommended dimensions:
Reference the endpoint you created in Step 1 as the
src. If you use sandbox, the following attributes must be whitelisted for the widget to work: sandbox="allow-forms allow-same-origin allow-scripts".Example
3
Create Application Event Listeners
Create listeners for the widget load and widget ping application events.
Example
4
Configure Widget Event Listeners
Configure event listeners for your widget events.Capture and parse the URLs necessary for your widget version:
- Insights Widget: Refer to the Insights Widget events table to determine which of your enabled insight templates create events that you need to handle.
- Mini Insights Widget: Capture and parse a URL for when the end user interacts with the View more call to action inside the widget. You must add a listener for this UI event to know when to navigate the end user to the Insights Widget.
- Micro Insights Widget: Capture and parse two URLs relating to the Micro Insights Widget events:
- A URL for when the user selects the View all call to action. When the user selects this, you consume the info we send to you in the URL and then send the user to the Insights Widget.
- A URL for when the user selects the Learn more call to action. When the user selects this, you consume additional information from the URL. This lets you send the user to the Insights Widget with the insight the user selected at the top of the feed.
Example
5
Optional: Filter Insights
You can filter which insights show in a specific Mini Widget instance. See Filter Insights for more information.
Congrats! You’ve integrated your Insights Widget!
Integrate on a Mobile App
To integrate the Insights Widget on a mobile app, follow these steps.1
Request a Widget URL
Create a backend endpoint that calls the Platform API to generate a widget URL. Set the value of
widget_type to your desired widget:- Insights Widget:
pulse_widget - Mini Insights Widget:
mini_pulse_carousel_widget - Micro Insights Widget:
micro_pulse_carousel_widget
is_mobile_webview field with a value of true in your request to access WebView event messages.See Example API Requests for different configurations.2
Load the URL
Load the URL received from the previous request into a WebView.
3
Build Event Logic
Capture the URLs delivered via You must capture the URL, parse out the path and query string, then JSON decode the metadata field.
window.location = "someurl" calls within the WebView and use the information provided in those calls to build the necessary logic for coordinating events.All MX URL message events have the
mx:// prefix and appear in the format mx://<entity|widget>/<event>?metadata=<metadata as an encodedURI JSON string>. For example: mx://account/created?metadata="{'guid':'ACT-1'}".4
Handle Widget Load and Widget Ping Events
Capture and parse a URL for the widget load and widget ping application events.
5
Handle Other Widget Events
Capture and parse the URLs necessary for your widget version:Insights Widget: Refer to the Insights Widget events table to determine which of your enabled insight templates create events that you need to handle.Mini Insights Widget: Capture and parse a URL for when the end user interacts with the View more call to action inside the widget. You must add a listener for this UI event to know when to navigate the end user to the Insights Widget.Micro Insights Widget: Capture and parse two URLs relating to the Micro Insights Widget events:
- A URL for when the user selects the View all call to action. When the user selects this, you consume the info we send to you in the URL and then send the user to the Insights Widget.
- A URL for when the user selects the Learn more call to action. When the user selects this, you consume additional information from the URL. This lets you send the user to the Insights Widget with the insight the user selected at the top of the feed.
6
Optional: Filter Insights
You can filter which insights show in a specific Mini Widget instance. See Filter Insights for more information.
Congrats! You’ve integrated your Insights Widget!
Common Problems
This section covers some common problems with loading a widget URL into a WebView.Minimum Size
Minimum Size
To embed our mobile widgets into a WebView, we require a device width of at least 320 pixels. Depending on the implementation of the WebView, smaller devices may not be provided the full width, leading to display issues.
WKWebView vs. UIWebView (iOS)
WKWebView vs. UIWebView (iOS)
Default Padding (iOS)
Default Padding (iOS)
By default, iOS adds additional padding to its WebViews, which sometimes causes problems.To fix this:
- Select the WebView providing the widgets in your application and navigate to the size inspector.
- Change the layout margins from
"Default"to"Explicit". - Update the left and right margins to
0. - Ensure the width is at least 320 pixels.
Default Margin (iOS and Android)
Default Margin (iOS and Android)
Whether using WebViews on Android or iOS, most browsers will have a default margin (set in the user agent stylesheet) on the body element when rendering the HTML page responsible for loading a widget. This margin is deducted from the total available width of the containing element, which will cause a problem.To fix this:
- Determine the computed width available on the
bodyelement. The width available to theiframecan be confirmed by inspecting theiframeinjected by MX and typingwindow.innerWidthin the JavaScript console. The width available to theiframemust be at least 320 pixels. - Confirm the
bodyandhtmlelements have their padding and margin set to0.
Viewport (iOS and Android)
Viewport (iOS and Android)
For mobile widgets to render correctly, the viewport must be set in a meta tag on the HTML page used to load the widget URL.The viewport is the size of the window through which a page is seen. It can be smaller or larger than the actual size of a page or device screen.On most mobile devices, the virtual viewport is larger than the actual screen size; web pages are rendered according to the viewport size, then shrunk down to the actual screen size. This helps when viewing pages that aren’t optimized for mobile, but for pages that are optimized for mobile (like the mobile widgets), the viewport meta tag is used to guarantee that the page is rendered properly.Set a meta tag within the
<head> element as follows:Example
Move Insight to Top of Feed
If you embedded the Mini or Micro Insights Widget, you must configure the View More call to action to send users to the Insights Widget. For a seamless experience, we recommend moving the insight they selected to the top of the Insights Widget. To request the Insights Widget with a specified insight displayed at the top:1
Request a Widget URL
Request the Insights Widget with the
insight_guid configuration. Set the value for the insight_guid to the value of the beat_guid you received from the Mini or Micro Insights Widget event.Platform API Example
2
Use the URL
The response from this Insights Widget request contains the URL for an Insights Widget that has the specified insight at the top of the feed.
(Optional) Filter Insights
To filter which insights appear in your Mini Insights Widget, requestmini_pulse_carousel_widget as the widget_type, then append a query string to the widget URL using the following format. Include at least one insight template name (no maximum limit). For compatible templates, see the Insights Library.
Widget URL with query string
Example API Requests
The following examples are for requesting a Widget URL in the Platform API. Add a Spanish-language widget to a website:Accounts Page
Transactions Page

