Hello, I’m running this transformation for Amplitu...
# support
w
Hello, I’m running this transformation for Amplitude:
Copy code
function transform (events) {
  events.forEach((event) => {
    switch (event.event) {
      case 'page':
        const index = events.indexOf(event);
        if (index > -1) {
          events.splice(index, 1);
        }
        break;
    }
  })
  return events;
}
It prevents any
page
to reach Amplitude. The output of the test gives a blank array
[]
but I still get page views on Amplitude. Any help?
a
Please change to
event.type
in the switch case. It should be fine
w
Thanks will try now
I didn’t work. I still get those events on Amplitude.
a
Please check this out. It should block all the
page
calls:
Copy code
function transform(events) {
    const mappedEvents = [];
    events.forEach(event => {
       if (event.type !== 'page') {
           mappedEvents.push(event);
       }
    });
    return mappedEvents;
}
w
I still get those events…