Single page app - form each field time spent

Avatar

Avatar

m_1985

Avatar

m_1985

m_1985

09-08-2016

Hi,

Is there a way to get amount of time spent on form each fields.?  any recommendations. 

update: the below code seems to be working by getting the name of the field and field timing on the browser console. But, it doesnt seem to be working when i include this code in DTM. I could understand sine the page is not reloading and that's the reason it is not working. Any help would be greatly appreciated

$(document).ready(function() {         
     var d=0;
     var t=0;
     $(':input').focus(function () {
     d=new Date();
     t =d.getTime();
                });
    $(':input').blur(function() {
    var e=new Date();
    var x = e.getTime();
    var exit = Math.round((x - t)/1000);
        var formPage = document.title;
                if($(this).val().length > 0){ 
                console.log($(this).attr('name'));
                console.log(exit);
    } 
        
    });
});

Thanks in advance.

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar

ParitMittal

Avatar

ParitMittal

ParitMittal

12-08-2016

Hi ,

We tried a similar thing at our end and included the time on field code which you provided in a  "Global Page Load Rule "  as a "Sequential Javascript" under  tab " Javascript / Third Party tag " and it was working and the time spent on a field was getting printed on the console.

Please find attached  snapshots for your reference and we would recommend to try out the same thing at your end and le tus know whether the same thing works for you or not

Thanks & Regards

Parit Mittal

Answers (0)