Rich-text Reply

Same variation across all devices?

kim222 04-19-16
Accepted Solution

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.

Level 1

MJBeisch 04-20-16

Re: Same variation across all devices?

Within Optimizely itself, this isn't possible. You can code a custom solution using the javascript API, but you'll need some way to server-side store which variation a signed in user sees first. You'll likely need the assistance of a web developer, as this requires putting together some javascript on the site itself and interacting with data fields in your site's CMS. It's a fairly advanced use case.


Rough Step-by-step process:

  1. 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.
  2. Get the ID of the variation the user is bucketed into
    Use this Optimizely javascript API call to check it:[experimentId]
    Replace [experimentId] with the ID of the experiment you are trying to do this with.
  3. Store the variation ID that you got in step 2 in the "Variation ID" data field you set up in step 1.
  4. Check the value of the "Variation ID" field any time the experiment runs.
  5. If the "Variation ID" field has a value, use it to force that variation to render.
    Use this Optimizely javascript API call to force a user to be bucketed into a specific variation:
    window.optimizely.push(["bucketVisitor", selectedExperiment, selectedVariation]);
    Replace "selectedExperiment" with the ID of the experiment, and "selectedVariation" with the variation ID that was stored.
Matt Beischel - E-Commerce Optimization Specialist CohereOne

Level 2

Re: Same variation across all devices?

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!






MJBeisch 04-22-16

Re: Same variation across all devices?

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.

Matt Beischel - E-Commerce Optimization Specialist CohereOne

Level 2
kim222 04-26-16

Re: Same variation across all devices?

Thanks for the quick reply guys! I think we'll just leave the requirement for a bit.
Level 1