Hi Team! We have an issue with experiments runnin...
# contributing
f
Hi Team! We have an issue with experiments running in in-app webviews. We are seeing the user ID change between different pages of our web user journey which is causing experiment results to be inaccurate. We are using Segment + Growthbook. Has anyone seen this before? Any help gratefully received.
f
Is the randomization unit changing? (Like the segment ID)?
f
Yes, each time they load a webview they get a different segment anonymous id (the webview is the final part of our conversion funnel).
f
that will cause them to be rebucketed
🙌 1
👍 1
b
my guess is your web view is implementing the JS segment SDK and your native apps perhaps the iOS and android SDK's, and there isn't a way for the apps to communicate with the web view to identify the user. it's been a while since i've used segment but if i recall correctly, it uses either cookies or local storage to set an ID if one doesn't exist, right? are you able to initialize the segment SDK in your web view with a user ID? (perhaps using their identify API's) one easy way to do this would be to do it via the URL using either a query param or fragment in the URL e.g.
?user_id=user-abc123
and have code that looks for this in the URL when identifying the user in the segment SDK. assuming you're talking about a mobile app, an alternative is to communicate from native code to tell the webview what the ID is when you have it. in android this could be with the javascript interface, and iOS it could be via WKWebViewConfiguration, you can have your controller implement WKScriptMessageHandler. if you're using flutter or react native, you'll need to find the relevant API's for those plugins you're using that abstract these native API's. the URL might be the easiest way to do it.