Same variation across all devices?
I've got a requirement that if customer Bob signs in a mobile device and sees variant A, if they then sign in via a desktop device they should also see variant A. Is there a way in Optimizely to enforce this? There are various properties on a customer that make them unique. It's also an Angualr app so we delay activating experiments until the controller for the view has loaded it's data.
Solved! Go to Solution.
Rough Step-by-step process:
- Set up a "Variation ID" field in your user data
Done according to however your CMS handles data. Will have to be able to accept and store a numeric value.
- Get the ID of the variation the user is bucketed into
window.optimizely.data.state.variationIdsMap[experReplace [experimentId] with the ID of the experiment you are trying to do this with.
- Store the variation ID that you got in step 2 in the "Variation ID" data field you set up in step 1.
- Check the value of the "Variation ID" field any time the experiment runs.
- If the "Variation ID" field has a value, use it to force that variation to render.
window.optimizely.push(["bucketVisitor", selectedExperiment, selectedVariation]);Replace "selectedExperiment" with the ID of the experiment, and "selectedVariation" with the variation ID that was stored.
Hi Kim and Matt,
Kim, thanks for asking and Matt, thank you for answering.
I have somethingto add to Matt's answer: there's one more thing you need to take into account here as well, and that's that a visitor changing variations after being bucketed already is not a use case that Optimizely takes into account. Once a visitor's been bucketed into a variation, that visitor will count for that variation from then on, even if the visitor's rebucketed later.
This means that checking for the variation ID is not quick enough. You'll have to forcefully bucket the user into a specific variation (the variation that the user has already seen before), before that user would be bucketed by Optimizely. And you'll have to do this before the Optimizely snippet. See our Bucket Visitor API call.
Let me know if you have any follow-up questions!
Yes, that was one thing that I wasn't specific about. You'll have to perform the variation check process I described above BEFORE the experiment runs. That means you'll have to use manual activation mode and place the activation script after the variation check script, then store the variation after the experiment runs.