Skip to main content
This guide covers the configuration settings that are available to you if you integrated your PFM Widget onto a website using the Widget Loader.
The Widget Loader is no longer the recommended method of integrating the PFM Widgets onto a website. To learn about the recommended method, refer to How to Integrate PFM Widgets.
For this guide, you’ll either use the Platform API or SSO API. The API you use depends on what you have purchased and have enabled. If you have the Nexus API enabled, you’ll use the SSO API.

Widget Loader Parameters

When you instantiate MoneyDesktopWidgetLoader, you must pass in an object with at least the required url parameter along with any optional parameters you wish to use:

Config Parameter

The config object contains the following configuration options:
  • accounts
  • budgets
  • connections
  • debts
  • goals
  • help
  • master
  • mini_budgets
  • mini_spending
  • mini_spending_plan
  • settings
  • spending
  • spending_plan
  • transactions
  • trends
Here’s an example of what the config object using the transactions option looks like:
Example
You can set the following configuration options. Boolean fields default to false unless otherwise specified.

Create a Loading Message

Any HTML placed inside of the widget placeholder element will be replaced once the widget iframe has loaded. This means you can use the placeholder element’s inner HTML to display a loading message. Because this is just HTML, it can be text, images, or anything you want. The following example adds some loading text that will appear until the widget has loaded.
Example

Resetting the Session Timer and Logging Out

MX provides two important functions for the widget loader: ping and logout. The ping function resets the session timer, allowing you to keep the session open as long as needed. The default timeout period is 900 seconds, and ping can be used anywhere in that period to restart the timer. A custom timeout period can be set by contacting MX, but MX recommends using the ping method rather than setting a longer timeout.
The logout function ends the session and redirects to the session timeout URL defined in your client profile. If no URL is defined, there is no redirect. Contact MX if you wish to set a specific session timeout URL.

Loading Multiple Widgets

To load multiple widgets on a single page:
  1. Define multiple placeholder elements, each with a unique CSS id.
  2. In your JavaScript, create an instance of MoneyDesktopWidgetLoader for each widget.
  3. Connect each loader instance to a placeholder element by setting the id property value as the CSS id.
After the page has loaded, all widgets will load in their respective elements. Here’s an example of loading three separate widgets onto a single page.
Example

Loading Widgets at Different Times

By default, widgets load automatically once the web page has loaded. If you’d like to load your widgets manually instead, you can use the autoload option by setting autoload to false when instantiating MoneyDesktopWidgetLoader. When you’re ready to load a widget, call the load method on the instance of MoneyDesktopWidgetLoader with the URL. Here’s an example of loading the Accounts Widget on page load, then loading the Transactions Widget when a button is selected.
Example

(Deprecated) Master Widget Deep Linking

Master Widget deep linking has been deprecated and is only supported for existing integrations.
By default, the Master Widget displays the Accounts Widget on initial load. If you want to display a different widget on initial load, set the deepLink attribute in MoneyDesktopWidgetLoader to one of the following values: For example, if you want your Master Widget to load the Spending Plan Widget by default, you can set deepLink to spending_plan as follows:
Example

(Deprecated) PostMessage Events

These events are deprecated and are only supported for existing integrations.
A postMessage is an event-based protocol that allows you to take action in your own codebase in response to events triggered within a widget’s user interface. They’re intended specifically to allow your code and a widget’s user interface to work in concert, not to give a full picture of events happening on MX servers. A postMessage event shouldn’t be used for analytics or for keeping data in sync between platforms. Webhooks are a more reliable way of coordinating events between your servers and MX servers. To learn more, read our Webhooks guide.

Maintaining Sessions

Because our widgets are embedded through iFrames, the parent frame (usually window) isn’t aware of any activity going on within the iFrame. This can cause the online banking session to time out even though the user is actively using a widget. To prevent this, each of our widgets will periodically send a postMessage to the parent frame. The postMessage will contain a JSON-formatted string as follows:
The most common way to take advantage of a postMessage event is to implement an event listener function that will capture any postMessage. Once captured, you can tell your application to maintain its session. Here’s an example of how to do this:

Widget Events

We send postMessage events when your application wants to know about specific events that have occurred within the widget iFrame. All widget postMessage events contain a JSON-formatted string with the following structure:

Event Triggers

View the widget event triggers associated with account, member, and transaction changes.
This event triggers when any account is created. The is_manual field can be used to distinguish manual accounts from other accounts.
This event triggers when a member is created and before any aggregation is initiated. The aggregation-related fields, such as most_recent_job_guid, may be null.
This event triggers when a new transaction is created. This includes the creation of child transactions when the parent transaction is split.
This event is triggered when popover content that has trapped focus onto a particular element is opened, but only in the case that no other popover content is already open. This event is triggered by drawers, menu buttons, and modals.

PostMessage UI Events in Mobile WebViews

Because of the technical limitations of WebView-based widget implementations, an alternative to the standard postMessage is required. MX has developed a simple URL-based updating mechanism to replace event messages that are available to other implementations. Capture these URLs and use the information provided in them to build the necessary logic for coordinating application events. When requesting widget URLs using the SSO API, you must include the is_mobile_webview field with a value of true in your request to access WebView event messages. URL event messages are availalbe for the widget events outlined in the following sections.
PostMessage events related to members, such as when a member is updated, will contain the connection_status field. This field indicates the current status of the member’s aggregation.

Sample Capture Scripts

The following are example capture scripts in the Java and Swift languages:
Java
Swift

Event Message Triggers

This event message triggers when any account is created. The is_manual field can be used to distinguish manual accounts from other accounts.
  • Base URL: mx://accountCreated
  • Example payload: mx://accountCreated?account_subtype=""?account_type="PROPERTY"?balance=25000?guid="ACT-12345"?id="A-12345"?is_closed="false"?is_hidden="false"?is_manual="true"?member_guid="MBR-12345"?name="Delorean"?property_type="VEHICLE"?type="account"
This event message triggers when any member is created.
  • Base URL: mx://memberCreated
  • Example payload: mx://memberCreated?accounts_count=0?connection_status="CREATED"?guid="MBR-12345"?id=""?institution_guid?"INS-12345"?is_manual="false"?is_user_created="false"?most_recent_job_guid?""?name="Zen Bank"?type="member"
This event message triggers when any transaction is created.
  • Base URL: mx://transactionCreated
  • Example payload: mx://transactionCreated?account_guid="ACT-12345"?amount=4.25?category_guid="CAT-12345"?date=1425384000?description="Transaction Description"?guid="TRN-12345"?has_been_split=false?memo="Transaction Memo"?parent_guid="TRN-45678"?transaction_type=2?type="transaction"