Track whether a file is downloaded in qualtrics | XM Community
Skip to main content

I have uploaded a word document to a survey and am hoping to track which survey takers down the document. I have used a previous thread about tracking whether a link is clicked to get started. I created an embedded variable, "download", and set it equal to "0". Then I used some javascript provided in this post: https://www.qualtrics.com/community/discussion/2809/track-whether-a-link-is-clicked-in-qualtrics-even-a-respondent-leaves-for-the-opened-new-page. I can tell that the issue is with the JQuery link since it uses a #extLink. However, I am not sure what to use here for a downloaded file. Any help would be appreciated.

Qualtrics.SurveyEngine.addOnload(function() {
  jQuery('#extLink').click(function(event) {
    Qualtrics.SurveyEngine.setEmbeddedData("download", "1");
  });

How are you setting up the file download? Link? Button?
Share a screenshot of question HTML


The file is downloaded by clicking on some of the highlighted text in the question.
Here is the HTML for the question:
If you are interested in learning more about covid-19 vaccine availability and would like to schedule an appointment please download the full document by clicking on the following text link: https://smeal.qualtrics.com/CP/File.php?F=F_3fkQ9Y7hp6JaWQ6" target="_blank">Covid 19 Vaccine Resources - Pennsylvania


Change it to this:
If you are interested in learning more about covid-19 vaccine availability and would like to schedule an appointment please download the full document by clicking on the following text link: Covid 19 Vaccine Resources - Pennsylvania
Now when someone clicks on it, download should be set to 1.


https://www.qualtrics.com/community/discussion/comment/35413#Comment_35413That did it. I appreciate the help ahmedA.


@ahmedA I actually have the same question, but I don’t understand the solution. What was changed? What was changed in the javascript?


this is same as your other question @jevans6  😀


ahmedA original comment:


Change it to this:

​If you are interested in learning more about covid-19 vaccine availability and would like to schedule an appointment please download the full document by clicking on the following text link: <span style="font-size:22px;"><strong><a href="https://smeal.qualtrics.com/CP/File.php?F=F_3fkQ9Y7hp6JaWQ6" target="_blank" id="extLink">Covid 19 Vaccine Resources - Pennsylvania </a></strong></span>

Now when someone clicks on it, download should be set to 1.


@Tom_1842 Thank you!


Hi, I’m trying to do the same thing, do you put this code in the javascript box? 


This is my current HTML code. 

Provided is a downloadable summary for working with gifted and talented youth:&nbsp;<a href="https://ucf.qualtrics.com//CP/File.php?F=F_038ZRLTKVM5zOl0" rel="noopener" target="_blank">Giftedhandout</a>&nbsp;

 

I am looking to track the number of downloads. I have tried support with zero luck. 


Hi! So you basically need to do 3 steps. First, you need to add an embedded link in your survey (in survey flow) before question where you have your PDF that you’d like to track and set it equal to 0. Then you need to add the following in javascript:

Qualtrics.SurveyEngine.addOnload(function() {
  jQuery('#extLink').click(function(event) {
    Qualtrics.SurveyEngine.setEmbeddedData("extLink", "1");
  });

 

I’m not sure whether this is necessary, but I make sure the embedded link, and the “extLink” above have the same name. The third piece is adding the “extLink” name in the html with id=”extLink”, which you don’t seem to have above. I think I usually put the id before “target”. Similarly, I just have all of the steps with the same name, as I’m not 100% sure which links to which so it makes it easier.

 

I hope this helps!


@jevans6 Thank you so much for your reply. I clearly did something incorrectly. It still says zero after I tested it. I think there is something I am doing incorrectly in step one. It appears like I am just creating a name and setting it to 0 which doesn’t feel right. Any thoughts? 


Leave a Reply