Experiment variant re-assignment & re-fetch on device

  • 1 February 2022
  • 2 replies




I’m evaluating Experiment for our needs and am trying to understand how to deal with following case:

User environment is mobile app. Suppose we’ve got a bunch of experiments set up. For some of them we need to get the assigned variant at app startup.

However, for some experiments we want to assign the variant only later - e.g. at screen #3. Our case in particular - we get ad attribution info with some delay and want to defer variant assignment for some experiments until then.

How would I set up Experiment and SDK integration to deal with this situation?


Related to above, if I understand the documentation correctly (looking at Android SDK docs [1]), once variants are fetched for the user then they are stored locally and never re-fetched. But what if I want variants to be re-assigned (as in situation above - user properties were updated) and “Sticky bucketing” is turned off for the experiment?




Best answer by tracy.guo 2 February 2022, 23:24

View original

2 replies

Userlevel 4
Badge +3

Hi @mkuprionis - thanks for your question!

once variants are fetched for the user then they are stored locally and never re-fetched.

It’s true that the variants are stored locally, however you can call fetch() again, as many times as needed, whenever you want to get the most up-to-date variants for the user.

Example: Let’s say you are running two experiments (E1) on your landing page and (E2) on your checkout page. (E2) targeting is based on whether or not the user is logged in. Both E1 and E2 have control and treatment variants

  1. User opens app for first time. On app init, experiment SDK is initialized and variants are fetch()ed for the anonymous user:  E1=treatment (since user is not logged in, user is not considered for E2 (e.g. off)
  2. The user logs into their account. You instrument your app to call fetch() with the new user ID: E1=treatment , E2=control
  3. User does some stuff, then purchases something and goes to checkout page where they experience the control experience for E2

In summary, you can call fetch() at different times when you need to evaluate the user again.

In your case, since the user will have updated user properties the second time you fetch, I’d recommend explicitly including the user properties in the fetch call as well:

  1. fetch({user_id:"abcd",device_id:"1234"})
  2. fetch({user_id:"abcd",device_id:"1234",user_properties:{property:"value"}})

Let me know if that helps!


Thanks @tracy.guo, this helps!