Hello! I have a script to collect the acceleration of a respondents phone that I would like to add to my survey, but my knowledge of Javascript is limited. What am I missing to make the connection between collecting this information and appending it to my data?
The original script is:
{
var start = now();
function SurveyMotion(e) {
this.acceleration = new Object();
if (e.accerleration !==null) {
this.acceleration.x = Math.sqrt(Math.pow(e.accerlation.x,2)+
Math.pow(e.acceleration.y,2)+
Math.pow(e.acceleration.z,2)).toFixed(2);
this.acceleration.g = abs(Math.sqrt(Math.pow(e.accelerationIncludingGravity.x,2)+
Math.pow(e.accelerationIncludingGravity.y,2)+
Math.pow(e.accelerationIncludingGravity.z,2))-
9.80665).toFixed(2);
this.acceleration.t = Math.round(now() - start);
} else {
this.acceleration.x = null;
this.acceleration.g = null;
}
this.interval.x = null;
if (e.interval !==null) {this.interval = e.interval;
}
return (this);
};
window.addEventListener("devicemotion", update_accel, false);
});
Question
Editing Javacript for Qualtrics (originally for Unipark)
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.
