Open areejSad opened 7 months ago
Hi @areejSad Thanks for reporting this issue.
What version of the SDK are you using? And can you link the flag/experiment in amplitude?
Thanks!
the version '1.13.0', sorry what do you exactly need? if you mean the space it's a private account for company
Is the deployment used to initialize the SDK added to the flag, and is the flag activated?
A link to the flag/experiment in Amplitude would be sufficient for me to check.
I can show you a photo, and yes it's added to the deployment environment, I also checked amplitudeExperimentAPIKey amplitudeAnalyticsAPIKey and it's the same added in the project. This issue only happened if I have multiple variant, but If I just changed it to one variant it will work fine in the same code. So I'm confused why.
this is a photo to check the flag and it's active
Thanks, and sorry for the delay.
This issue only happened if I have multiple variant, but If I just changed it to one variant it will work fine in the same code. So I'm confused why.
This most likely means that the user information (user_id and device_id) are not being sent in the fetch request.
Can you turn on the debug
config option and look for the logs with [Experiment]
in them? Specifically the on that has Fetch variants for user
Also, could you share how the Experiment SDK is initialized? Thanks!
yes exactly I'm intentionally making (user_id and device_id) as nil but it suppose to be ok right? because it's optional to have a user? and if there's no user it suppose to return a random variant right?
and this is how I initialize
===========
and this is how I fetch:
it says in the documentation:
yes exactly I'm intentionally making (user_id and device_id) as nil but it suppose to be ok right? because it's optional to have a user? and if there's no user it suppose to return a random variant right?
Not quite. When there is some form of randomization (e.g. 3 variants evenly distributed) then we need some input value to get a consistent output. Without a user ID or device ID we dont have an input for the hash function used to determine which variant the user should be assigned, so the result is empty.
Passing a nil user is generally if you are using the initializeWithAmplitudeAnalytics
initialization function or you have intialized the SDK with a custom UserProvider
I faced an issue, that the whole variant from experiment.variant(key.rawValue) return nil. This happens when I don't want to give a User since it's optional.
This is the flag with multiple variants: