Event Triggering
widgetEvent, persoenticsEvent and handleWidgetAction
This page details the following:
- Functions triggering the events:
- widgetEvent function - relevant to web layouts
- personeticsEvent function - relevant to mobile layouts
- handleWidgetAction
widgetEvent
The widgetEvent will be triggered for web layouts. It will be triggered by Personetics widget when a widget specific event occurs. For example, the teaser is clicked, view all button is clicked, story widget is closed, etc. Two types of events are supported:
- Functional events
- Action events
Parameters
Name | Type | Mandatory | Description |
---|---|---|---|
widget | Map | No | The widget object |
params_map | Map | Yes | event parameters |
Return value - None
Functional Events
Following are the provided events for func personeticsEvent(params: NSDictionary). These events are managed by the customer.
Event Name | Description |
---|---|
teaserClick | Indicates a teaser/tracker was clicked - Bank should activate the story-widget using the startWidget API. |
inboxWidgetStarted | Indicates 'view all' button was clicked. The bank should activate the inbox widget using the startWidget function. |
refreshInsights | Triggered by the corresponding widgets, when closing the manage-budgetswidget, or transactions modal. When sent, it means the user’s data was updated, and the user’s insights need to be recalculated. The bank should call the relevant API sequence to “refresh” the user’s insights – regenerate insights and fetch them (e.g. – call getInsights API) This should be effective when the dashboard / carousel widget is displayed, and should not require user logout / login |
Reporting | Event sent upon each interaction of the end-user with the application. For example, the number of times and end-user clicked a certain element, changing etc. This provides supporting statistics and analysis for end-user actions on the widget. |
Return Value: none
Following are examples of a teaserClick generated event, and the bank Implementation, where the story-widget is invoked using the startWidget function.
{
"widgetType": "inbox",
"eventType": "reporting",
"eventId": "teaserClick",
"eventData": {
"eventDateTime": "07/17/2023 10:09:10",
"insightId": "IntroducePersonetics",
"instanceId": "6f6c62d0-6312-48d5-9caf-2d3fdfbaa483",
"useCaseId": "IntroducePersonetics_UC1",
"value": "1"
}
}
{
"insightId": "6f6c62d0-6312-48d5-9caf-2d3fdfbaa483",
"eventType": "teaserClick"
}
this.widgetEvent = function widgetEvent(widget, params) {
const { widgetSelector } = params;
……
case "teaserClick":
if (channel !== "web") {
...
} else {
personetics.widgetsCallStack[widgetSelector] = personetics.widgetsCallStack[widgetSelector] ?? [];
personetics.widgetsCallStack[widgetSelector].push(appConfig.widgetType);
const startWidgetConfig = $.extend(true, appConfig, {
configurations: {
widgetType: "story-widget",
params: {
userId: params.authToken,
insightId: params.insightId,
instanceId: params.instanceId,
useCaseId: params.useCaseId,
eventType,
},
},
});
if (this.isPayload === "true") {
// note that the getInsightDetails was declared in predefinedData.js
startWidgetConfig.configurations.params.payload = {
GET_INSIGHT_DETAILS: window.getInsightDetails,
};
}
personetics.startWidget(startWidgetConfig);
}};
Action Events
Action Events List
These events are triggered in case of an action.
Action Name | Description |
---|---|
externalNavigation | sends a string to the bank’s delegate for external navigation from the widget |
externalNavigationURL | opens a defined URL within the widget |
CallPersoneticsAPI | sends a defined API request to the Pserver |
openStory | opens a story (from a teaser button) |
Following are examples of events triggered by a specific action, and the response to the triggered event.
externalNavigation
{
"actionId": "action2",
"actionType": "externalNavigation",
"payload": {
"navigateTarget": "navigateToURL",
"payload": {
"URL": "http://www.bank.com/register",
"externalLink": "false"
}
}
}
{
"action": "navigateToPage",
"data": {
"actionType": "externalNavigation",
"navigateTarget": "navigateToURL",
"payload": {
"URL": "http://www.bank.com/register",
"externalLink": "false"
}
}
}
callPersoneticsAPI
{
"actionId": "action1",
"actionType": "callPersoneticsAPI",
"payload": {
"apiName": "updateUserDataAssets",
"apiBody": {
"protocolVersion": "protocolVersion",
"lang": "lang",
"eventList": [{
"assetAlias": "commitedTxUpdate",
"assetId": "B_1009",
"value": "4"
}]
}
}
}
{
"protocolVersion": "2.6",
"lang": "en",
"eventList": [{
"assetAlias": "sustainabilityInterest",
"assetId": "B_1210",
"value": "4"
}],
"type": "updateUserDataAssets",
"ctxId": "dashboard"
}
openStory
{
"actionId": "action1",
"actionType": "openStory"
}
{
data: {
actionType: 'openStory',
},
},
teaserClick
personeticsEvent - Mobile
This function is parallel to widgetEvent operation. Refer to the widgetEvent function for the details.
handleWidgetAction
Platforms - all supported platforms
This function is called from the widgetEvent - Web, or personeticsEvent - Mobile function when handling action events.
Parameters
Name | Type | Mandatory | Description |
---|---|---|---|
widget | Map | No | The widget object |
params_map | Map | Yes | event parameters |
These events are triggered in case of an action:
Action Name | Description |
---|---|
externalNavigation | sends a string to the bank’s delegate for external navigation from the widget |
externalNavigationURL | opens a defined URL within the widget |
CallPersoneticsAPI | sends a defined API request to the Pserver |
openStory | opens a story (from a teaser button) |
Return Value - none
goToPersoneticsWidget - Android
Relevant platforms:Android
goToPersoneticsWidget function is Android specific. It Indicates a teaser was clicked. In response, the Bank should invoke the story-widget using the startWidget function.
Parameter
Name | Type | Mandatory | Description |
---|---|---|---|
config | Map | Yes | parameters: |
Return Value = none
Code Example
"userId": "ProgramUser_3", // example for userID
"insightId": "bd165da9-cf04-46da-ad22-1c8844a86454",// example for insightId of a clicked teaser
"instanceId": "ProgramTracker",", // example for instanceId of a clicked teaser
"useCaseId": "ProgramTracker_UC1", // example for useCaseId of a clicked teaser
"eventType": "teaserClick",
"lang": "en", //language
"clickedTeaser": <elm> //an element node of the clicked teaser
teaserId": "perso-teaser-template_bd165da9-cf04-46da-ad22-1c8844a86454" //an id attribute of the clicked teaser
}
Updated 4 months ago