Hello. I want to add a timestamp to when a page is submitted in Qualtrics. I tried this code:
Qualtrics.SurveyEngine.addOnPageSubmit(function() {
var datetime = new Date();
});
But it did not work. What am I doing wrong? Is there any other way to get the time stamp for when someone submits a page?
Time stamp for when respondent submits a page
+3
Hi, Seems like you would like to save date and time within the survey data?
In that case you need to set the embedded data variable. Refer an example code below.
Qualtrics.SurveyEngine.addOnPageSubmit(function() {
var currentdate = new Date();
var datetime = "date time: " + currentdate.getDate() + "/"
+ (currentdate.getMonth()+1) + "/"
+ currentdate.getFullYear() + " @ "
+ currentdate.getHours() + ":"
+ currentdate.getMinutes() + ":"
+ currentdate.getSeconds();
Qualtrics.SurveyEngine.setEmbeddedData(<Name of Embedded variable>, datetime);
});
Hi Gauri,
When you say it is not working, do you mean it is not recording in your Qualtrics dataset? I'm a bit of a novice with javascript, but based on the code in your question it does not appear that it is doing anything with the timestamp other than storing it as a javascript variable.
If that is the issue, take a look at this similar question that has been resolved. Scroll down through a few of the responses to see a potential explanation.
Leave a Reply
Enter your username or e-mail address. We'll send you an e-mail with instructions to reset your password.