How to name embedded data fields using loop & merge values | XM Community
Question

How to name embedded data fields using loop & merge values

  • 28 July 2020
  • 3 replies
  • 20 views

I've got a survey where I'm using loop & merge to loop through a few hundred images with links (participants see a random subset).
I am using javascript to record whether they click on the link provided, and it records an embedded data field with a 0 or a 1, like this:
Qualtrics.SurveyEngine.addOnload(function() {
  $('link').on('click', function(name, event) {
    Qualtrics.SurveyEngine.setEmbeddedData("clicked${lm://CurrentLoopNumber}", '1')

I know that I need to have an embedded data field created in my survey flow, so I can create a few hundred embedded data fields.
The problem is that I want to name the embedded data fields with the information from the loop & merge fields (this would contain the image ID, for example).
I don't really want to have to create several hundred embedded data fields by hand, one with each image id.
Is there an easy way to simply pipe in the Field/1 values from loop & merge?


3 replies

Userlevel 7
Badge +27

I just commented on this same question on Stackoverflow.
Qualtrics only records embedded fields it knows about so your options are limited. The only alternative way to dynamically define a lot of embedded fields is to have a web service create them.

https://www.qualtrics.com/community/discussion/comment/28272#Comment_28272Thanks, TomG.
So basically I should create them by hand?
What kind of web service could I use to create those embedded fields- I'm not familiar with anything like that?

Userlevel 7
Badge +27

If you have a web host to host a script, you can have the script programmatically output all the embedded data fields you need in json format. Add the web service call to the survey flow, click Test, click on select All then Add.

Leave a Reply