microscopic-gpu-23322
01/19/2023, 12:40 PMmetadata(event).destinationId but does not work obviously.
Here my transformation so far:
export function transformEvent(event, metadata) {
const identifyChannelId = "2IgciJhF4ItDIbBGyGdomODk9R2";
const trackChannelId = "2KSWHpnG6cSXbR6GDo3RbXfaI6y";
const eventType = event.type;
if (eventType == "identify") {
metadata(event).destinationId = identifyChannelId;
}
if (eventType == "track") {
metadata(event).destinationId = trackChannelId;
}
return event;
}hundreds-lifeguard-65770
01/19/2023, 12:53 PMhundreds-lifeguard-65770
01/19/2023, 12:55 PMmicroscopic-gpu-23322
01/19/2023, 1:36 PMhundreds-lifeguard-65770
01/19/2023, 1:40 PMhundreds-lifeguard-65770
01/19/2023, 1:41 PMhundreds-lifeguard-65770
01/19/2023, 1:42 PMexport function transformEvent(event, metadata) {
if (eventType == "identify") {
return;
}
}hundreds-lifeguard-65770
01/19/2023, 1:43 PMmicroscopic-gpu-23322
01/19/2023, 2:06 PMhundreds-lifeguard-65770
01/19/2023, 2:09 PMhundreds-lifeguard-65770
01/19/2023, 2:10 PMmicroscopic-gpu-23322
01/19/2023, 2:11 PMmicroscopic-gpu-23322
01/19/2023, 2:11 PMmap ?hundreds-lifeguard-65770
01/19/2023, 2:19 PMhundreds-lifeguard-65770
01/19/2023, 2:26 PMconst eventMap = [{
"event": "alias",
"dest": "2IgciJhF4ItDIbBGyGdomODk9R2"
},
{
"event": "identity",
"dest": "2KSWHpnG6cSXbR6GDo3RbXfaI6y"
}]
export function transformEvent(event, metadata) {
//get dest for this event
let dest = eventMap.find(e => e.dest === metadata(event).destinationId);
if (dest && dest.name === event.event){
return event;
}
return;
}hundreds-lifeguard-65770
01/19/2023, 2:28 PMmicroscopic-gpu-23322
01/19/2023, 2:37 PMhundreds-lifeguard-65770
01/19/2023, 2:39 PM