Open alanosman opened 7 years ago
Following up. I actually got it to work finally. I found that when I drop the $
symbol from distinct_id: sess._id
, I can get it to work. The piece of code below now works for me. I will say though, that this was challenging to figure out and it would be better if front-end and back-end worked the same. Even if this was documented somewhere, I could not find it. It would also be nice if you had a real API guide, one that enumerates with an index all the functions.
const logIt = event => (req = null, data = null) => {
const person = {
distinct_id: sess._id,
$set: {
$first_name: sess.name,
$last_name: sess.lastname,
$email: sess.email,
},
$ignore_time: false,
};
mixpanel.people.set(sess.id, person);
const args = Object.assign ({}, person, data);
mixpanel.track(event, args);
};
I have spent a good day trying to get to the bottom of this. The documentation does a bad job at making a distinction between server and client mixpanel features. They are not the same as you are led to believe they are, though i do understand why. Server and client side events are different, with different properties associated. I understand that we do not get browser, location etc. But, through our back end flow, we do know what action the user is taking, therefore, I should be able to assign an event to a user profile much like I do on the front end. However, this doesn't seem to work.
I have tried many combinations, and none of them actually actually associate the event to a user. I see the extra data I am defining for the person come in as properties, but if I click the person icon in mixpanel to reveal previous events, I don't get anything, just a spinner.
I'm using this:
Why is this not working for me?
This is what I get inside mixpanel when I click on an event from the server https://www.screencast.com/t/kfeM221u