FR: Support for targeting user properties in real time with Remote Config (parity with iOS & Android SDKs) #8662
Description
Operating System
MacOS
Environment (if applicable)
Any browser
Firebase SDK Version
10.9.0
Firebase SDK Product(s)
Analytics, Remote-Config
Project Tooling
Elm app
Detailed Problem Description
Our app has mobile clients on iOS and Android which use firebase-ios-sdk
and firebase-android-sdk
for feature flagging. The way feature flagging works on those platforms is:
- we have parameters in Remote Config with conditions based on user properties (something like
app.userProperty['some_prop'].exactlyMatches(['some_value'])
) - when a user logs in, we set the user property
- we then fetch the Remote Config with a
minimumFetchInterval
of0
and activate to get the updated values specific to that user
We recently implemented a web app that uses the firebase-js-sdk
and realized that this approach to feature flagging is not supported on Web because there's a delay between setting the user property and seeing the correct Remote Config value for that user property in the response from getValue
.
This has been reported as a bug a few times already:
- Remote config returns stale value #8334
- remoteConfig.getString doesn't return values for conditions based on user properties #2990
- Remote Config Parameters with Conditions are Inconsistent and Often Incorrect #3230
- remoteConfig.getString doesn't return values for conditions based on user properties #2221
The response to the bug reports has been that this is expected behavior, and it is noted in the documentation that the JS SDK differs from the mobile SDKs on this. (I think that's what this is saying:
Note: On Web, it can take several hours for a property to be available for targeting. See the documentation for user properties on Web/JavaScript for more information.
?)
I'm submitting this as a feature request in case there's any plan of supporting this functionality in the web/JS SDK.
Steps and code to reproduce issue
See the repro steps here and here:
- create a user property in Remote Config (
foo
) - create a condition matching on that property (
app.userProperty['foo'].exactlyMatches(['bar'])
) and a string parameterbaz
that branches on that condition to return values'foo is bar'
when the condition is true,'default value'
as default - fetch and activate Remote Config from a JS client using
remoteConfig.settings.minimumFetchIntervalMillis = 0
- set user property (call
setUserProperty(analytics, { foo: 'bar' })
) - fetch and activate again (call
fetchAndActivate(remoteConfig)
) - see that the boolean returned is
false
indicating the config did not activate despite new user property - call
getValue(remoteConfig, 'baz')
- see that the value is the default
'default value'
Activity