Javascript calculating a field and storing in console, turn into embedded data | XM Community
Skip to main content
Hi community,



I am a researcher trying to implement a typing tool calculation into qualtrics using JS built by my companies internal team. That typing tool takes the answers of 5 questions and spits out one of four "types".



The javascript accurately calculates the types and displays in the console. Now the issue I am struggling with is figuring out how to turn that calculation into embedded data that qualtrics can capture and log so I can use it in further analysis and data cuts.



My hunch is using something along the lines of this command: Qualtrics.SurveyEngine.setEmbeddedData



But am having trouble understanding how this works, where it goes in my code, and how to set it up from the front end to capture it.



Can anyone help out here?



Thanks!
Hello @mercec ,



In the typing tool code, where ever you see `console.log` below that just add this line



` Qualtrics.SurveyEngine.setEmbeddedData( 'EmbedddedData_VariableName', EmbeddedDataValue );`



Make sure you have embedded data declared in the survey flow before this calculation.



If you are unaware where JS is written in qualtrics then - it will be either in js at question level or in the header (under look and feel tab)
Thank you so much!!



And when you say declared... you mean just set the embedded data field in thes urvey flow and name it?
> @mercec said:

> Thank you so much!!

>

> And when you say declared... you mean just set the embedded data field in thes urvey flow and name it?



Yes

Leave a Reply