In some cases when you trigger an action, you might want to discard the collected data and do nothing. In these cases, you can direct the getActions
or getActionsData
method to perform no action. No data is returned in this case. Use this option to improve performance when you do not want to alter your site or the collected data.
getActions
Reports an event and immediately requests a decision from Monetate.
getActions(actionType, context?, eventData?, includeReporting?) : Promise<any>
Parameters:
actionType
is the type of action you want to request. You can specify one action or multiple actions in an array to handle.context
is name of the event.eventData
is the data associated with the event.includeReporting
indicates whether the response will have impression reporting data.
Use NoAction
as the action type for this method.
Example code:
let recData;
personalizationInstance
.getActions("monetate:action:NoAction")
.then(res =>
{
recsData = res[0].actions;
})
.catch(error =>
{
console.warn('Error!', error);
});
getActionsData
This method sends the defined events to Monetate to trigger an experience. If the events fulfill the WHO settings of an experience, then that experience is triggered.
getActionsData(actionType: Array<string>, includeReporting?: boolean) : Promise<any>
Parameters:
actionTypes
is the type of action you want to request. You can specify one action or multiple actions in an array to handle.
Use NoAction
as the action type for this method.
let recData;
personalizationInstance
.getActionsData("monetate:action:NoAction")
.then(res =>
{
recsData = res[0].actions;
})
.catch(error =>
{
console.warn('Error!', error);
});