Edit: using the API Timestamp allows more granular...
# questions
c
Edit: using the API Timestamp allows more granularity as that is measured in actual ms and is actually recording the specific time. It's strange though, as despite the specific date and time popping up in the UI when looking at the saved dates, when cast to a number these saved dates are taken to 05:00 UTC on the day they were done, rather than their specific time. I think I'm gonna just have to take the loss on events that happen the day of for now. Hi everyone! This feels like something that might be easy to do in Mixpanel, but has anyone had any success being able to track the number of events before and after another event occurs? For clarity, let's say we have two events, A and B, where B is not necessarily granted, and we want to make an insights report that shows the number of times users do event A before they do event B (if they ever even do). Is there a simple way to do this? I know it's easy enough to make a cohort to see the number of users who do event A then B, but if I try to filter the insights report by that cohort, it doesn't necessarily mean all of the event A being tracked would be BEFORE event B. To make it easier, we do track a timestamp for when event B occurs as a user property. My attempted workaround, which does almost what I want it to, is to make a custom event property to find the difference between the timestamp of the event and the time of the event B timestamp saved as a user property. At first I tried to use the
datedif()
function with the smallest unit, which I believe is just days, and can judge whether event A happened before or after B by the result. This works well except when events A can happen in the same day as event B. I thought I saw that Mixpanel saves those timestamps as unix times, so I thought perhaps I could work around the datedif limitations and make a new custom event property along the lines of
number(.Atime) - number(.BTimestamp) < 0 or number(.time) - number(.BTimestamp) == undefined
. If the difference is less than 0 then that means the user did the event before event B, and if it is equal to undefined, that means event B has not happened yet and so all events A are still happening before B. I think the logic of this works well, but it seems like we run into the same issue as the datedif where if the two events happen in the same day then the difference in time is just rounded to 0. Not a huge deal as the data that happens the same day definitely doesn't make or break things, but it seems like all the ingredients are there to make this work nicely. Am I overthinking this? Is there a better/easier way to go about it? Sorry for the long post. Hope it was coherent! Any tips are appreciated.