How to edit custom events in AppsFlyer
This guide will help you to edit custom events in AppsFlyer.
You can see the list of events sent to AppsFlyer here
Steps
- Add this filter in the eventsHelper.js file in the your-theme/helpers/eventsHelper.js file.
- Add the following code in the updateAppsFlyerEvents function.
import { appmaker } from '@appmaker-xyz/core';
function updateAppsFlyerEvents () {
appmaker.addFilter(
'appsflyerEventData',
'custom-events',
({ eventName, params, eventObject }) => {
console.log('eventName', eventName)
switch (eventName) {
case 'af_viewed_content':
console.log('params', params); // params is an object object which contains the sending event attributes of the event.
console.log('eventObject', eventObject); // eventObject is an object that contains whole data for the event.
// example of updating the event params object using the eventObject
params['Product ID'] = eventObject?.product_sku?.value;
break;
case 'af_add_to_cart':
eventName = 'af_added_to_cart'; // example of updating the event name
params['Product ID'] = eventObject?.product_sku?.value;
break;
default:
break;
}
// sending the updated params and eventName
return {
eventName,
params,
};
},
);
}
export { updateAppsFlyerEvents }
- call this updateAppsFlyerEvents function in the your-theme/index.js file activate.