Rich-text Reply
Highlighted

getVariation vs getForcedVariation?

d-a-n 09-13-18
Accepted Solution

getVariation vs getForcedVariation?

Regarding to the docs you have to use `setForcedVariation` to enforce a variation to test agains. Then it reads to use `getForcedVariation` to get the variation. Why is that? I would assume that the enforced variation is retuned by `getVariation` and not having to have another switch for all integration points.

Level 2

CouchPsycho 09-13-18
 

Re: getVariation vs getForcedVariation?

Well,

imagine you want to check, if the current variation was set directly / forced. getVariation returns the variation, which is active but no information if it was set using the force ;-)

 

getForcedVariation returns only the variation if it was set by force otherwise null. Having both methods available you have more freedom to react to different scenarios or requirements.

Kind regards

Michael


   
d-a-n 09-13-18
 

Re: getVariation vs getForcedVariation?

HI Michael,

thanks for clarifying. Would be great if you could add this to the docs.
Level 2
CouchPsycho 09-13-18
 

Re: getVariation vs getForcedVariation?

optimzely support team should do so ;-)
Kind regards

Michael