Search code examples
javascriptqualtricsexternal-links

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


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');
        });
});

Solution

  • 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');
            });
    });