Is it possible set Embedded Data in the Google Chrome Developer Console? | XM Community
Question

Is it possible set Embedded Data in the Google Chrome Developer Console?

  • 21 September 2020
  • 4 replies
  • 22 views

Userlevel 2
Badge

I have a simple question. I am wondering if it is possible to replace all instances of an embedded data using my browser's console. For example, suppose I define an embedded variable in my survey `var = cat`. I then create the rest of my survey and pipe in my

var
in several places and everything runs normally.
I am wondering if it possible modify this variable within the Chrome console. For example is it possible using the console I could do something like Qualtrics.SurveyEngine.setEmbeddedData("var", "dog") and have my survey page to reload to show what it would look like under this new value?


4 replies

Userlevel 5
Badge +4

Hi,
Yes, it is possible, the setEmbeddedData and getEmbeddedData works in console as well.
Make sure you open the console by inspecting element, if you directly press F12 and try to run the code it won't work.

image.png

Userlevel 2
Badge

@SurajK, thank you for this good start! I'm wondering though if it is possible to update the page I'm currently looking at as well.

So for example, if I updated the embedded data could I update all of the occurrences of the piped text on a page I'm currently viewing, or at least on the next page of the survey.

Userlevel 5
Badge +7

Hey SurajK , my getEmbeddedData() function is currently not working in JS inside my questions. It did last year despite not being listed as a working method in Qualtrics' own question API documentation. I also can't call it in my developer tools as your screenshot shows. If I type in Qualtrics.SurveyEngine.getEmbeddedData("PYQ36_1"), I receive an error: Uncaught ReferenceError: Qualtrics is not defined.

Any ideas? Thanks!

Userlevel 7
Badge +21

https://www.qualtrics.com/community/discussion/comment/32569#Comment_32569As SurajK had mentioned, you need to inspect some element in the survey, otherwise Qualtrics doesn't get initialized and hence will throw the error that you are seeing.
Also, as far as I can tell, you can only access the embedded variables that are being used on the specific page you are on and not any others.

Leave a Reply