Open app

Tutorial 15 · Advanced logic

URL variables and random groups

Personalize a survey from a declared link parameter and assign each respondent to a stable experiment group.

Step-by-step guideSetup · Flow · Test

1. Prepare the survey

Open a practice survey from Home and click Edit. Add these pages and questions in the order shown. Click a question type in the builder palette, then select the question to edit its label and choices. Use Add Page for later pages.

PageQuestionType and setup
Personalized sessionCampaign: general · Group: unassignedText box · Optional initially

Follow along in a practice survey in the VividSurvey app. Screenshots illustrate each step.

2. Configure the logic

  1. Declare the campaign

    Choose URL variables and random groups. Click Add variable. Set URL parameter to campaign, Type to Text, and Default to general.

  2. Add random assignment

    Click Add variable again. Set URL parameter to experiment, Type to Random group, and Group names, separated by commas to Group A,Group B. These names are case-sensitive values you can use in conditions.

  3. Review and save variables

    Click Next, inspect both declarations, and Save logic.

  4. Use the values in text

    Use Insert a previous answer to insert campaign into Question text with Text before the answer set to Campaign: and a space, and fallback general. Use the same wizard again to insert experiment into that question’s Description, with prefix Group: and fallback unassigned. The supplied review example shows both values in one label.

  5. Open a campaign link

    Publish. Add ?campaign=spring to the public survey URL before first opening the respondent session. The app assigns the experiment group; it is not selected by the campaign parameter.

In the app. Configure url variables and random groups using the values in this tutorial.Click the screenshot to enlarge it. Press Escape to close.

3. Review the logic flow

Read the final flow before saving. For conditional rules, YES means the condition matches and NO means it does not. An unanswered source can leave the rule waiting. Use Try answers when it is available, or Back to adjust the setup. View full survey flow provides the surrounding page order and saved rules.

In the app. The final flow review for url variables and random groups, before Save logic.Click the screenshot to enlarge it. Press Escape to close.

4. Save and publish

  1. Save the reviewed logic

    On the final wizard step, click Save logic. Your changes join the survey draft. If the tutorial creates more than one rule or setting, complete and save every part before publishing.

  2. Confirm the draft is saved

    Close Logic. Wait for the builder’s save/sync status to complete. You can reopen Logic to check the saved rule or setting. Save logic does not by itself update the public survey.

  3. Publish the survey

    Click Publish in the builder, then Publish Now in the confirmation. Use the public link to test the published survey. After later edits, publish again before checking the live result.

  4. Test in a fresh respondent tab

    Start with a fresh public survey tab. If you already had an older published version open, reload and start a new response. Use a practice survey for test submissions.

5. Test the respondent experience

Run both the matching and alternative cases. Change answers and revisit earlier pages where the test asks you to, rather than testing only one path.

Try thisExpected result
Open a fresh ?campaign=spring linkCampaign reads spring and a Group A or Group B value is displayed.
Reload that respondent sessionThe campaign and random assignment stay fixed.
Use a fresh session without campaignThe declared default general is used.
In the app. The fresh campaign=spring link supplies the campaign text and the session supplies a random group.Click the screenshot to enlarge it. Press Escape to close.

Common mistakes and useful limits

  • URL values are public input, not proof of identity or permission.
  • Change link parameters before starting a new respondent session; an existing session retains its captured values.