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.
Widget Loader Parameters
When you instantiateMoneyDesktopWidgetLoader, you must pass in an object with at least the required url parameter along with any optional parameters you wish to use:
Config Parameter
Theconfig object contains the following configuration options:
accountsbudgetsconnectionsdebtsgoalshelpmastermini_budgetsmini_spendingmini_spending_plansettingsspendingspending_plantransactionstrends
config object using the transactions option looks like:
Example
false unless otherwise specified.
Create a Loading Message
Any HTML placed inside of the widget placeholder element will be replaced once the widgetiframe 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.
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:- Define multiple placeholder elements, each with a unique CSS
id. - In your JavaScript, create an instance of
MoneyDesktopWidgetLoaderfor each widget. - Connect each loader instance to a placeholder element by setting the
idproperty value as the CSSid.
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 theautoload 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.
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.
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 (usuallywindow) 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:
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 sendpostMessage 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.- Account Created
- Account Updated
- Account Deleted
This event triggers when any account is created. The
is_manual field can be used to distinguish manual accounts from other accounts.- Member Created
- Member Updated
- Member Deleted
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.- Transaction Created
- Transaction Updated
- Transaction Deleted
This event triggers when a new transaction is created. This includes the creation of child transactions when the parent transaction is split.
- Focus Trap: trapped: true
- Focus Trap: trapped: false
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 standardpostMessage 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
- Account Created URL
- Account Updated URL
- Account Deleted URL
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"
- Member Created URL
- Member Updated URL
- Member Deleted URL
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"
- Transaction Created URL
- Transaction Updated URL
- Transaction Deleted URL
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"

