How to Change Attached Video Dynamically
Let’s assume you want to collect feedback on a photography video course hosted on your YouTube channel. The course consists of 78 videos, and you want to embed each video on a Voiceform page to gather user feedback. While creating 78 individual questions is an option, it would be too time-consuming. Instead, we’ll show you how to use dynamic variables to achieve this efficiently.
Step 1: Setting Up the Dynamic Variable
- Create a survey in Voiceform.
- Navigate to the Settings section and create a new dynamic variable called
video_link
. - This variable will be used to pass the video link dynamically through metadata.
Step 2: Adding a Feedback Question
- Add a new question to your survey.
- Use the text: "Please share your feedback about the video."
- In the right-side panel, scroll to the Attachment section and locate the Video Attachment option.
- Select the Embed tab.
Step 3: Embedding the YouTube Video
-
Choose the YouTube embedding option.
-
Add the following embedding code to the text box:
<iframe width="560" height="315" src="https://www.youtube.com/embed/dwrGAoZIrOw?si=sMAFSvR011a0jD4V" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen> </iframe>
-
This code attaches a specific video to your question. However, to make it dynamic, you need to replace the
src
attribute with thevideo_link
variable.
Step 4: Making the Video Dynamic
-
Modify the
src
attribute in the embedding code to include thevideo_link
dynamic variable. The updated code will look like this:<iframe width="560" height="315" src="{{video_link}}" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen> </iframe>
-
This ensures the video link is dynamically replaced based on the variable passed when the survey is accessed.
Step 5: Sharing the Survey with Dynamic Video Links
-
When sharing your survey, include the video link as part of the URL by appending it as a query parameter.
-
For example:
https://app.voiceform.com/to/my_survey_hash?video_link=https://www.youtube.com/embed/3k2lFp47e6A?si=0hk3GcHQISlGEyun
This setup dynamically embeds the specified video into the survey, allowing users to provide feedback on each video seamlessly without creating separate questions for all 78 videos.
Updated about 1 month ago