Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

randomize frames

More
9 years 6 months ago #111749 by fabiu
randomize frames was created by fabiu
Hey guys,

in my survey I compare 2 homepages. I'd like to put them in my survey with a iframe and then randomize them - so the user either gets to see homepage/ frame A oder homepage/ frame B. Is this possible and if so, how?

thanks!
The topic has been locked.
  • Mazi
  • Mazi's Avatar
  • Offline
  • Official LimeSurvey Partner
  • Official LimeSurvey Partner
More
9 years 6 months ago - 9 years 6 months ago #111753 by Mazi
Replied by Mazi on topic randomize frames
If you embed the frame as answer option e.g. at a list radio question, you can set to randomly list the options. This can be set at the advanced question settings: manual.limesurvey.org/QS:Random_order

Best regards/Beste Grüße,
Dr. Marcel Minke
Need Help? We offer professional Limesurvey support: survey-consulting.com
Contact: marcel.minke(at)survey-consulting.com
Last edit: 9 years 6 months ago by Mazi.
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
9 years 6 months ago #111757 by tpartner
Replied by tpartner on topic randomize frames
I would put the iframes in separate text-display questions and control their visibility via relevance based on a random number in a hidden equation question.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
More
9 years 6 months ago #111777 by fabiu
Replied by fabiu on topic randomize frames
So I tried to figure out an equation but none will work. The frames work perfectly fine, but they're just listed below each other. What is the equation supposed to look like?
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
9 years 6 months ago #111783 by tpartner
Replied by tpartner on topic randomize frames
Assuming that your equation question precedes the text-display questions and has a code "random1", the equation in "random1" should be:
Code:
if(random1 > 0, random1 , rand(1, 1))

The relevance for the first text-display:
Code:
random1 == '1'

The relevance for the second text-display:
Code:
random1 == '2'


.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
More
9 years 6 months ago - 9 years 6 months ago #111797 by fabiu
Replied by fabiu on topic randomize frames
ok so I found the code
Code:
{rand(1,2)}
and it worked perfectly fine - it showed either 1 or 2.

So I thought I could just put my frames in here instead of the 1 and the 2:
Code:
{rand(
('<iframe src="https://epetitionen.bundestag.de/" width="1000" height="600" ></iframe>'),
('<iframe src="https://www.uni-wuerzburg.de/" width="1000" height="600"></iframe>')
)}

all I see is an empty box, but I dont get any error messages. Is there an error in my code, which I just don't see?
Last edit: 9 years 6 months ago by fabiu.
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
9 years 6 months ago - 9 years 6 months ago #111798 by tpartner
Replied by tpartner on topic randomize frames
That will not work, rand() is a PHP function. Please read the manual - manual.limesurvey.org/Expression_Manager#Access_to_Functions

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last edit: 9 years 6 months ago by tpartner.
The topic has been locked.
  • Mazi
  • Mazi's Avatar
  • Offline
  • Official LimeSurvey Partner
  • Official LimeSurvey Partner
More
5 years 4 days ago #181672 by Mazi
Replied by Mazi on topic randomize frames
Have a look at this example for setting up A/B tests at Limesurvey: survey-consulting.com/how-to-randomize-i..._used_for_AB_testing

Best regards/Beste Grüße,
Dr. Marcel Minke
Need Help? We offer professional Limesurvey support: survey-consulting.com
Contact: marcel.minke(at)survey-consulting.com
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose