Skip to main content

Hi! 

I have a bit of an issue searching a user by custom attribute `is_desktop`. User attributes were set with a call to `batch` API with a following payload

{
api_key: process.env.AMPLITUDE_TOKEN,
events:
{
user_id: userId,
time: 1652278787263,
event_type: '$identify',
user_properties: {
$set: {
is_desktop: 1,
is_real_estate: 0,
},
},
},
],
}

User record got successfully updated, but doesn’t appear in search results, even after 10 hours since update  

For some reason integer values in search window didn’t appear either, only True, False and None are available

What should i do to make it work?

Hey @alexv
If there isn’t any event from this user after this identity call, then most likely the latest updated value for is_desktop will only be reflected at the top of the user's profile. This will not appear in chart results.

You can read more on how Amplitude updates user properties in here.

Hope this helps.


Hey Saish! Thanks so much for your help! Afterwards event indeed did the trick 


Hi!

A follow-up question. After passing event along with $identify call, user properties do appear on search now, but unexpectedly i can search for same parameter `is_desktop` but with different values  `true`, `false`, 1 and the same user will appear in the search results.  

Is it some kind of expected behavior? How can i make that only user with `is_desktop = true` will appear on search but not the others?

{
api_key: process.env.AMPLITUDE_TOKEN,
events: e
{
user_id: userId,
time: 1652278787263,
event_type: '$identify',
user_properties: {
$set: {
is_desktop: 1,
is_real_estate: 0,
},
},
},
{
time: currentTime,
event_type: 'some event ',
user_id: userId,
session_id: currentTime,
},
],
}

 


Looks like in the advanced user search, you are filtering on the user_id and the specific value for is_desktop. And since the user_id  627xxx7874 has had all possible values for is_desktop. i.e 1,True and False, they are returning positive results

You can verify this by creating a user composition chart for the is_desktop property and filtering on just this particular user_id.

Try removing the user id filter and using just where is_desktop = True

You can alternatively create a user seg chart as well with the same filter to get the user events where is_desktop = True.


H Saish, thanks for reply!
I used `user_id` in search because it shows this particular user in search results, otherwise it doesn’t appear there. If i understand you right, if user had all possible values set in the past (true, false, 1) he will appear on search for all of them, and this is an expected behavior?
Do you know  if there is a way to make only recent results appear on search?  


Yes. Since, Amplitude is an event based analytics platform, all charts and cohorts query at the event level. Charts will return the user property value at the time of an event.

I’m still not sure what the exact use case for search is here.

If you want to display the latest values for a user property, you can create a user composition chart like here with the Most Recent Value clause. And then use the user_id filter.

 

 


Hey Saish, thanks so much for your idea with Most Recent Value, gonna give it a try, hope it will meet our marketing team requirements


Reply