Skip to main content

How to edit custom events in the CleverTap

​

Introduction​

​ This document will help you understand how to edit custom events in the CleverTap.

You can see the list of events sent to clevertap here

Steps​

​

  1. Add this filter in the eventsHelper.js file in the your-theme/helpers/eventsHelper.js file.
  2. Add the following code in the updateCleverTapEvents function.
import { appmaker } from '@appmaker-xyz/core';
​
function updateCleverTapEvents () {
appmaker.addFilter(
'cleverTapEventData',
'custom-events',
({ eventName, params, eventObject }) => {
console.log('eventName', eventName)
switch (eventName) {
case 'Product Viewed':
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 'Added to Cart':
eventName = 'Add to Cart'; // example of updating the event name
params['Product ID'] = eventObject?.product_sku?.value;
break;
case 'Added to Wishlist':
params['Product ID'] = eventObject?.product_sku?.value;
break;
default:
break;
}
// sending the updated params and eventName
return {
eventName,
params,
};
},
);
}
export { updateCleverTapEvents }
  1. call this updateCleverTapEvents function in the your-theme/index.js file activate.