Use an event property id in place of user_id

  • 14 March 2023
  • 3 replies



I’m wondering if there’s any way to use a string sent as an event property in place of the user_id for the event.




In the product there are events where a user takes action on another users posts e.g. like, comments, etc. In the ‘like sent’ event for example there is an event property called ‘target_user_id’ which has the user_id of the user receiving the like. I’m wondering if there is a way to use this field in a new event so that the result would measure when a user receives a like (instead of gives a like) and could be used in subsequent engagement and retention analysis.


Thank you!


Best answer by Saish Redkar 16 March 2023, 19:35

View original

3 replies

Userlevel 7
Badge +10

Hi @tacosyburritos
Interesting use case, kinda sounds like an “derived event, but based on another user’s call”.

There are derived properties out there, but they will stick on user_id of the doer rather than the receiver if using the target user id. Also,afaik, there isn’t a direct way to tie a user id field to an event property in any analysis for now.

With your current schema, you can answer Qs like :

  • Which users send the most likes ( using count of “like sent” event grouped by User ID )
  • Which users receive most likes ( using count of “like sent” event grouped by target_user_id )

For now, I think you should generate the like received event in parallel to your like sent event and ingest in Amplitude.
I’ll repost here in case I find any better workaround.

Thank you Saish!

Too bad there’s no immediate solution, but will work to implement the like received event and in the meantime play with some workarounds.


Which users receive most likes ( using count of “like sent” event grouped by target_user_id )


The problem I see with this at the moment is that it will only show the top N users sorted by likes received. I wanted to try and get a representative sample of like receivers and then use them in cohort for further analysis, but this will only surface the top of the top. Do you know of any way to see the full output or a representative sample rather than just Top N?


Thank you!

Userlevel 7
Badge +10


Thanks for elaborating your use case further. I’m assuming you have the cohort feature for your plan?

So using this event segmentation chart with the group by still applied, you can export the csv will the target_user_id being one of the exported columns. Make sure you have the time frame wide enough to get the desired number of users who got likes.

Once you have this, you can clean this file to just include the user ids and then upload this file to create a cohort for those who have received likes.