Is it possible to use external JavaScript library (d3.js)? | XM Community
Question

Is it possible to use external JavaScript library (d3.js)?

  • 1 March 2024
  • 2 replies
  • 80 views

Badge

Hi everyone,

 

I was wondering if it is possible to import a Javascript library on Qualtrics?

I have interactive visualizations made with d3.js that I want to show in the survey, however, I haven't been able to run any d3.js code in Qualtrics. I tried inserting the library references into the header, following this. (<script src="https://d3js.org/d3.v4.min.js"></script>) However, it is not working.


Any advice would be appreciated, thank you!


2 replies

Userlevel 7
Badge +22

You need to click on the HTML icon and add the script tag there. Alternatively, add the following code in which ever question you want to use the library.

Qualtrics.SurveyEngine.addOnload(function () {jQuery.getScript("https://d3js.org/d3.v4.min.js");});

 

I would however not recommend using d3.js as it is quite a complex library and you may not be able to do some things within the Qualtrics environment.

Userlevel 7
Badge +22

See this page for some screenshots related to the header: 

 

Leave a Reply