tracking specific urls clicked within a Qualtrics survey | XM Community
Skip to main content

I have a survey in which there are 3 urls within the question. We want to track which specific urls are clicked rather than just a url was clicked. I have this code for that with the embedded data of clicked=0

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

});

But I can't figure out a good way to modify this to be able to know the specific url clicked, since the jQuery is #extLink and really this code is only counting if something is clicked but not specifically what.

Any advice?

This is also an example of what the HTML code looks like for each option in the question.  <div><a href="https://www.directrelief.org/" id="extLink" rel="noopener" target="_blank">Direct Relief</a> - Support for people affected by emergencies</div>

Assign different ids to each anchor tag as shown below:

<div><a href="https://www.directrelief.org/" id="extLink1" rel="noopener" target="_blank">Direct Relief</a> - Support for people affected by emergencies</div>
<div><a href="https://www.directrelief.org/" id="extLink2" rel="noopener" target="_blank">Direct Relief</a> - Support for people affected by emergencies</div>
<div><a href="https://www.directrelief.org/" id="extLink3" rel="noopener" target="_blank">Direct Relief</a> - Support for people affected by emergencies</div>

Create functions for each ids and store the data in different embeeded data:

jQuery('#extLink1').click(function(event) {
Qualtrics.SurveyEngine.setEmbeddedData("clicked1", "1");
});
jQuery('#extLink2').click(function(event) {
Qualtrics.SurveyEngine.setEmbeddedData("clicked2", "1");
});
jQuery('#extLink3').click(function(event) {
Qualtrics.SurveyEngine.setEmbeddedData("clicked3", "1");
});

 


@mblanyon , I am looking to use tags to track URL clicks as well and am not having much success with the code (it’s not generating metadata). Are you adding this to the Javascript field available in the question or somewhere else? Any information is appreciated. 


Leave a Reply