If you integrated using the Widget Loader, see 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 widget requires these whitelisted attributes: 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 set to true in your request to access WebView event messages.See Example API Requests for different configurations.2
Load the URL
Load the URL 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 their information to build the 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
Common problems with loading a widget URL into a WebView:Minimum Size
Minimum Size
Embedding our mobile widgets in a WebView requires a device width of at least 320 pixels. Depending on the WebView implementation, smaller devices may not get the full width, causing display issues.
WKWebView vs. UIWebView (iOS)
WKWebView vs. UIWebView (iOS)
Default Padding (iOS)
Default Padding (iOS)
By default, iOS adds padding to WebViews, which can cause problems.To fix this:
- Select the WebView that provides the widgets in your app and open 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)
In both Android and iOS WebViews, most browsers apply a default margin (set in the user agent stylesheet) to the body element of the HTML page that loads the widget. This margin reduces the containing element’s available width, which causes problems.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 screen, so pages render at the viewport size and then shrink to fit the screen. This helps with pages that aren’t optimized for mobile, but mobile-optimized pages (like the mobile widgets) use the viewport meta tag to ensure they render 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 selected insight to the top of the Insights Widget. To show a specific insight at the top of the Insights Widget:1
Request a Widget URL
Request the Insights Widget with the
insight_guid configuration. Set insight_guid to the beat_guid you received from the Mini or Micro Insights Widget event.Platform API Example
2
Use the URL
The response contains a URL for an Insights Widget with the specified insight at the top of the feed.
Localize the Insights Widgets
Pass your desired language in theAccept-Language header when you call the Request Widget URL endpoint.
Widgets default to en-US and support en-CA, en-US, es, fr, and fr-CA.
(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
These examples request a Widget URL in the Platform API. Add a Spanish-language widget to a website:Accounts Page
Transactions Page

