How to record the time an external link is clicked in Qualtrics?

162 Views Asked by At

The link provided here answers how Qualtrics records if an external link is clicked or not. Tracking when an external link is clicked in Qualtrics with javascript

But can I know when or the exact time that the link is clicked? What is the Javascript I can use? Thanks!

Update 1:

Qualtrics.SurveyEngine.addOnload(function() {
    $('extLink').on('click', function(name, event) {
        Qualtrics.SurveyEngine.setEmbeddedData('clicked', '1');
        Qualtrics.SurveyEngine.setEmbeddedData('clicked at ' + new Date(), '1');
        });
});

Update 2: Embedded data part:

clicked=0${date://CurrentDate/c}
Qualtrics.SurveyEngine.addOnload(function() {
    $('extLink').on('click', function(name, event) {
        Qualtrics.SurveyEngine.setEmbeddedData('clicked at ' + new Date().toGMTString(), '1');
        });
});
1

There are 1 best solutions below

0
Henrique Sabino On BEST ANSWER

Try using this piece of code here:

Qualtrics.SurveyEngine.addOnload(function() {
    $('extLink').on('click', function(name, event) {
        Qualtrics.SurveyEngine.setEmbeddedData('clicked at ' + new Date(), '1');
        });
});

Or this one if you want your embedded data to be of a string type

Qualtrics.SurveyEngine.addOnload(function() {
    $('extLink').on('click', function(name, event) {
        Qualtrics.SurveyEngine.setEmbeddedData('clicked at ' + new Date().toGMTString(), '1');
        });
});