Javascript to set custom values torandomise within block | XM Community
Skip to main content
Solved

Javascript to set custom values torandomise within block


Paul_Farrell
Level 2 ●●
Forum|alt.badge.img+5

Hi, 

Not sure if this is possible, but looking to set up randomisation in a block, but with a custom display %.

 

We currently have a block at the front of a survey that contains 2 questions, and 2 pieces of static information (research T&Cs and Privacy notice). The 2 questions are currently being randomised using the native block randomiser to display evenly to each respondent. In reality, we need Q1 to be shown to 80% of respondents, Q2 to 20%. Aware you can set custom values within the native randomiser, but these are based on counts and not %. Ideally looking for an unmonitored solution as this would be utilised across around 20 surveys. 

 

Not sure if the above is even possible with blocks, but thought I’d ask! 

 

Thanks

Best answer by TomG

@Paul_Farrell - You can use display logic instead of block randomization.  Set an embedded data field to show Q1 or Q2 and set the embedded data field in a survey flow randomizer with evenly present and Q1 set 4 times and Q2 set one time.

View original

4 replies

Nam Nguyen
QPN Level 8 ●●●●●●●●
Forum|alt.badge.img+29
  • QPN Level 8 ●●●●●●●●
  • 1091 replies
  • October 11, 2023

@Paul_Farrell I don’t have a way to do it within a block. But a workaround is you can put Q1 & Q2 in 2 different block and place 4 block Q1 and 1 block Q2 in a randomizer that present 1 out of 5. That will give you 80/20 ratio.
Hope this helps


TomG
Level 8 ●●●●●●●●
Forum|alt.badge.img+27
  • Level 8 ●●●●●●●●
  • 5923 replies
  • Answer
  • October 11, 2023

@Paul_Farrell - You can use display logic instead of block randomization.  Set an embedded data field to show Q1 or Q2 and set the embedded data field in a survey flow randomizer with evenly present and Q1 set 4 times and Q2 set one time.


Paul_Farrell
Level 2 ●●
Forum|alt.badge.img+5
  • Author
  • Level 2 ●●
  • 6 replies
  • October 11, 2023

@TomG I can't believe a solution so simple escaped me. Thanks for suggesting, I think this is the best way forward. 

 


Nam Nguyen
QPN Level 8 ●●●●●●●●
Forum|alt.badge.img+29
  • QPN Level 8 ●●●●●●●●
  • 1091 replies
  • October 11, 2023
TomG wrote:

@Paul_Farrell - You can use display logic instead of block randomization.  Set an embedded data field to show Q1 or Q2 and set the embedded data field in a survey flow randomizer with evenly present and Q1 set 4 times and Q2 set one time.

@TomG Brilliant 👍


Leave a Reply