Solved

Track event and set profile in a single request

  • 5 March 2020
  • 1 reply
  • 80 views

I’m tracking user registrations from backend. I’d like to send them email from mixpanel after registration.

As I understand, first I need to send some event to /track/ endpoint, like so:

{
  "event": "user_registered",
  "properties": {
    "distinct_id": "some@mail.com",
    "token": "000",
  }
}

 

And then add email to their profile at /engage/ endpoint:

 

{
  "$distinct_id" : "some@mail.com",
  "$token" : "000",
  "$set" : {
    "$email" : "some@mail.com",
  }
}

 

This works ok, but I was wondering if it’s possible to do this in a single event? I tried settings ‘email’ in the first message, but it doesn’t work - email is not set to user’s profile. The problem with two requets is that I need to ensure that the first one is completed before sending second one, which complicates code. So is it possible to do this in a single request?

icon

Best answer by stephanie 11 March 2020, 23:11

Hi @alpogos

Taking a step back, event data and user profile data are two sets of different data. If you would like to send your user an email after registration, you will need to set a user profile property with $email on it (more details here).

Being that they are two sets of separate data, you cannot send an event with an email, and then be able to see the email in the user profile to target. You would have to additionally send in user profile as well.  

View original

1 reply

Userlevel 5
Badge +4

Hi @alpogos

Taking a step back, event data and user profile data are two sets of different data. If you would like to send your user an email after registration, you will need to set a user profile property with $email on it (more details here).

Being that they are two sets of separate data, you cannot send an event with an email, and then be able to see the email in the user profile to target. You would have to additionally send in user profile as well.  

Reply