Is it possible to get user properties or just set them? I’m currently using `Identify().append()` to add Optimizely experiment IDs to an `experiments` property, but if a user visits the same page, that experiment is added to the array again. I’m trying to figure out how I can avoid duplicating items in the array.
Hey there,
Thanks for writing in!
We use Identify to work with user properties and currently this is indeed the best way to update / edit/ set user properties.
To avoid duplication you could try and build some internal logic in your code that would check current items in the array and only append a new one if it does not exist yet (e.g if...else)
That’s what comes to mind!
You could try to make a call using User Profile API and check properties assigned to a specific user.
Read more on it here:
https://www.docs.developers.amplitude.com/analytics/apis/user-profile-api/#get-user-properties
I would not be able to provide exact code snippets but maybe someone on the forum implemented something like this in the past? Would love to hear your experience!
Best,
Zhenia
Reply
Welcome to the Amplitude Community!
If you don't have an Amplitude account, you can create an Amplitude Starter account for free and enjoy direct access to the Community via SSO. Create an Amplitude account. You can also create a Guest account below!
If you're a current customer, select the domain you use to sign in with Amplitude.
analytics.amplitude.com analytics.eu.amplitude.comWelcome to the Amplitude Community!
If you don't have an Amplitude account, you can create an Amplitude Starter account for free and enjoy direct access to the Community via SSO. Create an Amplitude account. Want to sign up as a guest? Create a Community account.
If you're a current customer, select the domain you use to sign in with Amplitude.
analytics.amplitude.com analytics.eu.amplitude.comEnter your E-mail address. We'll send you an e-mail with instructions to reset your password.