chilly-television-36470
12/05/2023, 11:42 PMtrack with a trait called `email.`The data gets sent successfully but IF its a NEW user inside iterable - the system does not create a new user - it becomes some sort of ghost profile. Coming from mParticle - we were able to send custom events - and as long as it had an email included - a user will be updated or created. Curious if someone could take a look at this integration and see if its possible to alter this functionality. Would be nice to not always have to use identifty. Sometimes we just want a quick custom event with the emailmillions-activity-52391
12/05/2023, 11:42 PMchilly-television-36470
12/05/2023, 11:56 PMchilly-television-36470
12/05/2023, 11:57 PMchilly-television-36470
12/06/2023, 12:20 AM<script>
var cartEmail = '{{cart_email}}';
rudderanalytics.track("added_to_cart", {
'namespace': '{{namespace}}'
}, {
traits: {
email: cartEmail
}
});
</script>chilly-television-36470
12/06/2023, 12:21 AMmillions-activity-52391
12/06/2023, 5:34 AMmillions-activity-52391
12/06/2023, 7:55 AMshy-kite-21035
12/06/2023, 11:57 AMexport function transformEvent(event, metadata) {
const {type, userId} = event;
// Return the original event if type is not track
if (type !== "track") return event;
// Fetch email from context or properties
const email = event.context?.traits?.email || event.properties?.email;
if (type === "track" && !userId && email) {
// Update the userId with email if present
event.userId = email;
}
return event;
}shy-kite-21035
12/06/2023, 11:58 AM