Hello! I've searched for this and I couldn't find an exact answer, but it seems like it should be pretty straightforward. I've embedded a YouTube video in my survey. I want to check how many times the participant has clicked "replay" on the video. When I record clicks on the page, it records all clicks so that doesn't necessarily mean they clicked on the video! Is there a way to only record how many times they hit replay?
Thank you!!
Page 1 / 1
I have never used a video in Qualtrics, but I'm able to compute how many times respondent clicked on some of the radio buttons in a question. If there was not the condition, clicks anywhere in the question area would count. It might be possible to modify this code for videos.
this.questionclick = function(event, element) {
if(element.type == "radio") {
var n = Qualtrics.SurveyEngine.getEmbeddedData('n');
n = n + 1;
Qualtrics.SurveyEngine.setEmbeddedData('n', n);}
}
this.questionclick = function(event, element) {
if(element.type == "radio") {
var n = Qualtrics.SurveyEngine.getEmbeddedData('n');
n = n + 1;
Qualtrics.SurveyEngine.setEmbeddedData('n', n);}
}
> @fleb said:
> I have never used a video in Qualtrics, but I'm able to compute how many times respondent clicked on some of the radio buttons in a question. If there was not the condition, clicks anywhere in the question area would count. It might be possible to modify this code for videos.
>
> this.questionclick = function(event, element) {
> if(element.type == "radio") {
> var n = Qualtrics.SurveyEngine.getEmbeddedData('n');
> n = n + 1;
> Qualtrics.SurveyEngine.setEmbeddedData('n', n);}
> }
Thank you! I was thinking of just adding a back button to the next page and then recording how many times the participant hits the back button. (I would tell them they can click "back" to watch the video again.)
Do you know how I could record if they click on the back button?
> I have never used a video in Qualtrics, but I'm able to compute how many times respondent clicked on some of the radio buttons in a question. If there was not the condition, clicks anywhere in the question area would count. It might be possible to modify this code for videos.
>
> this.questionclick = function(event, element) {
> if(element.type == "radio") {
> var n = Qualtrics.SurveyEngine.getEmbeddedData('n');
> n = n + 1;
> Qualtrics.SurveyEngine.setEmbeddedData('n', n);}
> }
Thank you! I was thinking of just adding a back button to the next page and then recording how many times the participant hits the back button. (I would tell them they can click "back" to watch the video again.)
Do you know how I could record if they click on the back button?
> Do you know how I could record if they click on the back button?
I think it is possible, but I don't know how to do it.
However, I know how to do it with your custom button.
Just replace the word "radio" by "button" in your script and add following HTML to your question.
`<button type="button">Your text</button>`
Another way would be to update count each time the page with the video is loaded, which means once for the first time and then each time right after the click on the back button. This will also give you the number you want. If you wish to do it this way, just remove the first two lines from my original code (and the last parenthesis).
I think it is possible, but I don't know how to do it.
However, I know how to do it with your custom button.
Just replace the word "radio" by "button" in your script and add following HTML to your question.
`<button type="button">Your text</button>`
Another way would be to update count each time the page with the video is loaded, which means once for the first time and then each time right after the click on the back button. This will also give you the number you want. If you wish to do it this way, just remove the first two lines from my original code (and the last parenthesis).
> @fleb said:
> I have never used a video in Qualtrics, but I'm able to compute how many times respondent clicked on some of the radio buttons in a question. If there was not the condition, clicks anywhere in the question area would count. It might be possible to modify this code for videos.
>
> this.questionclick = function(event, element) {
> if(element.type == "radio") {
> var n = Qualtrics.SurveyEngine.getEmbeddedData('n');
> n = n + 1;
> Qualtrics.SurveyEngine.setEmbeddedData('n', n);}
> }
I tried changing the "radio" to "PreviousButton" in your code, but I still did not see any collection of clicks in my data. Do you know if I'd have to do something else?
> I have never used a video in Qualtrics, but I'm able to compute how many times respondent clicked on some of the radio buttons in a question. If there was not the condition, clicks anywhere in the question area would count. It might be possible to modify this code for videos.
>
> this.questionclick = function(event, element) {
> if(element.type == "radio") {
> var n = Qualtrics.SurveyEngine.getEmbeddedData('n');
> n = n + 1;
> Qualtrics.SurveyEngine.setEmbeddedData('n', n);}
> }
I tried changing the "radio" to "PreviousButton" in your code, but I still did not see any collection of clicks in my data. Do you know if I'd have to do something else?
> @fleb said:
> Another way would be to update count each time the page with the video is loaded, which means once for the first time and then each time right after the click on the back button. This will also give you the number you want. If you wish to do it this way, just remove the first two lines from my original code (and the last parenthesis).
This would be awesome! I tried deleting the first two rows and adding it in my video page, but I didn't see any new variable appear for number of times the page loaded. I just put this in the JS section and didn't change anything else. Do I need to do something more?
{
var n = Qualtrics.SurveyEngine.getEmbeddedData('n');
n = n + 1;
Qualtrics.SurveyEngine.setEmbeddedData('n', n);}
}
(also sorry I replied to your earlier post before seeing your second one!)
> Another way would be to update count each time the page with the video is loaded, which means once for the first time and then each time right after the click on the back button. This will also give you the number you want. If you wish to do it this way, just remove the first two lines from my original code (and the last parenthesis).
This would be awesome! I tried deleting the first two rows and adding it in my video page, but I didn't see any new variable appear for number of times the page loaded. I just put this in the JS section and didn't change anything else. Do I need to do something more?
{
var n = Qualtrics.SurveyEngine.getEmbeddedData('n');
n = n + 1;
Qualtrics.SurveyEngine.setEmbeddedData('n', n);}
}
(also sorry I replied to your earlier post before seeing your second one!)
Hi @Matthew,
1) You have to define all your embedded fields (in this case `n`) in the survey flow manually.
2) There is one extra closing parenthesis in your code.
3) Make sure that your code is placed after `Qualtrics.SurveyEngine.addOnload(function()`. This part is executed when the page is loaded. If the code is placed elsewhere, it does not make sense for you.
4) You can display `n` during previewing of the survey (for purpose of troubleshooting) by adding `alert(n)` to the code. If you add this line each time to a different place of code, you should get some idea where is the problem.
1) You have to define all your embedded fields (in this case `n`) in the survey flow manually.
2) There is one extra closing parenthesis in your code.
3) Make sure that your code is placed after `Qualtrics.SurveyEngine.addOnload(function()`. This part is executed when the page is loaded. If the code is placed elsewhere, it does not make sense for you.
4) You can display `n` during previewing of the survey (for purpose of troubleshooting) by adding `alert(n)` to the code. If you add this line each time to a different place of code, you should get some idea where is the problem.
Hi @fleb
Thank you for your reply!
I fixed the extra closing parathesis, but I'm not sure how to manually define n. What would code look like for that? I tried using n=addOnload but that did not work!
Thank you for your reply!
I fixed the extra closing parathesis, but I'm not sure how to manually define n. What would code look like for that? I tried using n=addOnload but that did not work!
> @Matthew said:
> Hi @fleb
>
> Thank you for your reply!
>
> I fixed the extra closing parathesis, but I'm not sure how to manually define n. What would code look like for that? I tried using n=addOnload but that did not work!
>
>
There is no code for that. If there were a code for that I would have written it to my previous responses. Just click on "Survey flow" and create the field. This link should help you.
> Hi @fleb
>
> Thank you for your reply!
>
> I fixed the extra closing parathesis, but I'm not sure how to manually define n. What would code look like for that? I tried using n=addOnload but that did not work!
>
>
There is no code for that. If there were a code for that I would have written it to my previous responses. Just click on "Survey flow" and create the field. This link should help you.
Leave a Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.