Unable to pass custom data to Qualtrics through JavaScript on submission of survey | XM Community
Skip to main content

Unable to pass custom data to Qualtrics through JavaScript on submission of survey

  • August 23, 2022
  • 6 replies
  • 449 views

Forum|alt.badge.img

Hi everyone! I'm also in a similar position. I'm using Qualtrics to record feedback data. However, I also want to record some metadata (

groupId
) around this. I'm passing the metadata through JavaScript according to the documentations mentioned. Below is my HTML code snippet:




I have included this in the base HTML file. Most of the script was mentioned in the documentation. I've only added the
addOnload
method. However, on my server, it says
Uncaught ReferenceError: Qualtrics is not defined
. Isn't the script supposed to define Qualtrics on its own? Could anyone point out what I'm missing here? Thanks!

6 replies

TomG
Level 8 ●●●●●●●●
Forum|alt.badge.img+27
  • Level 8 ●●●●●●●●
  • August 23, 2022

Are you using Site Intercept? If so, see this.


Forum|alt.badge.img
  • Author
  • August 24, 2022

Hi Tom! Yes, I'm using a site intercept. I have added variables for capturing embedded data in the Qualtrics intercept. Also, I'm passing these values (

groupId, permissions, email, firstName, etc.
) through JavaScript as mentioned in the code block below. When I run my app, there is a console error which says
Uncaught ReferenceError: Qualtrics is not defined
. I thought that the script included will take care of defining Qualtrics in the scope?






Screenshot 2022-08-24 at 2.32.07 PM.pngI've added groupId above in the Qualtrics dashboard but I'm not getting the value here. What could be the possible fix here?
PS: I'm able to see the intercept on my app and I'm also able to submit responses. It's just that I'm unable to send metadata along with the responses.


TomG
Level 8 ●●●●●●●●
Forum|alt.badge.img+27
  • Level 8 ●●●●●●●●
  • August 24, 2022

https://community.qualtrics.com/XMcommunity/discussion/comment/48760#Comment_48760I'm no expert on Site Intercept, but I think you have to set groupId in the Intercept setup as a 'Value from JavaScript' as described on the page I linked:
Value from JavaScript: This option captures custom JavaScript from your site. The specified value needs to be a JavaScript expression/call.


Forum|alt.badge.img
  • Author
  • August 25, 2022

Thanks Tom! I was thinking we need to send the data somehow to Qualtrics. Just declaring the variables did the trick.


Forum|alt.badge.img+1
  • October 3, 2022

Hello regatron can you share the code that fixed the problem ? what do you mean by "Just declaring the variables did the trick."


Forum|alt.badge.img

Hello, were you guys able to fix this problem? I'm facing the same issue and can't find this Qualtrics object anywhere in the page.