用于记录点击链接到 PDF 的 Javascript 代码 - Qualtrics [英] Javascript code to record click on link to PDF - Qualtrics

查看:33
本文介绍了用于记录点击链接到 PDF 的 Javascript 代码 - Qualtrics的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于在 Qualtrics 中构建的调查实验,我需要记录受访者是否单击了指向我的一个问题所附的 pdf 文档的超链接.我已经设置好 pdf 文档在另一个选项卡中打开.我不精通 Javasctript.记录此信息的最简单解决方案是什么?提前谢谢你!

For a survey experiment built in Qualtrics, I need to record whether respondents clicked on a hyperlink to a pdf document attached to one of my questions. I have set it up so that the pdf document opens in another tab. I am not proficient with Javasctript. What would be the simplest solution to record this information? Thank you in advance!

另一位用户提出了一个关于跟踪外部网页的超链接点击的类似问题,但我不确定当文档不完全是外部网页时是否可以使用点击.

Another user asked a similar question about tracking hyperlink clicks to an external webpage, but I'm unsure if I can use a click thru when the document isn't exactly an external webpage.

推荐答案

这个过程有3个部分:

1:使用特定 ID 设置链接,例如:

1: Set your link up with a specific ID for example:

<a id="myLink" href="http://communicus.com" target="_blank">Test Link</a>

2:对于您需要的问题,添加以下 JavaScript(根据需要调整脚本中的 ID 和嵌入数据变量):

2: For the question that you need this on, add the following JavaScript(adjust the ID and embedded data variable in the script as necessary):

Qualtrics.SurveyEngine.addOnload(function()
{
    var a = $("myLink"); //adjust ID here

      a.onclick = function() {
          Qualtrics.SurveyEngine.setEmbeddedData("clicked", 1); //adjust embedded data variable here
      }

});

3:在调查流程部分添加嵌入的数据变量,以匹配您的 JavaScript.确保它存在于您的问题所在的块之前的调查流程中.

3: Add the embedded data variable, to match your JavaScript, in the survey flow section. Make sure that it exists in survey flow prior to the block your question resides in.

这将让您跟踪点击 Qualtrics 变量中链接的人.

This will let you track those who clicked the link in a Qualtrics variable.

这篇关于用于记录点击链接到 PDF 的 Javascript 代码 - Qualtrics的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆