Skip to main content
Solved

Experiment variant re-assignment & re-fetch on device

  • February 1, 2022
  • 2 replies
  • 519 views

Forum|alt.badge.img

Hi,

 

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?

 

[1] https://developers.experiment.amplitude.com/docs/android-sdk#fetch-variants-for-a-user

Best answer by tracy.guo

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!

View original
Did this topic help you find an answer to your question?

2 replies

tracy.guo
Team Member
Forum|alt.badge.img+3
  • Amplitude Support
  • 39 replies
  • Answer
  • February 2, 2022

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!


Forum|alt.badge.img
  • Author
  • New Member
  • 1 reply
  • February 4, 2022

Thanks @tracy.guo, this helps!


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings