Have an idea?

Visit Sawtooth Software Feedback to share your ideas on how we can improve our products.

Is measuring the time duration a mouseover is active possible?

Within my CBC analysis I'd like to find out if a respondent triggered a mouseover by accident or deliberately.

Therefore I'm looking for a possibility, to measure the time duration the mouseover is active.

Can this be achieved within Lighthouse Studio?

Thank you very much for any assistance!

Kind regards,
asked Nov 18 by Philipp
This mouseover behavior is coming from using the ToolTip function in one of your CBC levels, correct?
Hi Zachary, yes that is correct.
I'm using HTML code within one of the CBC levels to show a picture and mouseover text:

<img src="[%GraphicsPath()%]PictureName.PNG" alt="" border="0"><br>
<span class="tool_tip_link">Details</span>
<div class="tool_tip_text" style="max-width: none;">
<img src="[%GraphicsPath()%]Mouseover_Picture.PNG" alt="" border="0"></div>

1 Answer

0 votes
Best answer
To start, we'll need to add a free format question to the same page as any CBC tasks where you want to record this time.  The free format question should be given a hidden, decimal type variable named "_mouseover."  The HTML for the free format question can be set to this:

<input name="[% QuestionName() %]_mouseover" id="[% QuestionName() %]_mouseover" type="hidden" value=""/>

    var startTime;
        startTime = new Date();
        var diff = new Date() - startTime;
        var time = Number($('#[% QuestionName() %]_mouseover').val()) || 0;
        time += diff / 1000;
        $('#[% QuestionName() %]_mouseover').val(time.toFixed(2));

Note that I am assuming there only exists one tooltip on the page.  If multiple exist that need to be recorded separately, the code will need to be adjusted.
answered Nov 18 by Zachary Platinum Sawtooth Software, Inc. (129,150 points)
Thank you very much for the quick reply. It is working!

Unfortunately there will be 6 mouseovers per page (two levels per concept, three concepts) that shall be recorded separately.

I'd really much appreciate another hint on how to modify the code accordingly.

Thanks a lot!
To support multiple tooltips, we'll want to start by adding unique IDs to each tooltip.  For example, the first of these:

<span class="tool_tip_link">

could be changed to this:

<span class="tool_tip_link" id="tooltip1">

The free format question will need six variables instead of just one.

Finally, my posted code can be repeated six times.  In each repeat, ".tool_tip_link" will need to be replaced with "#tooltip1" (or whatever ID you gave to that respective tooltip HTML) and each "_mouseover" will need to be updated with the name of that free format variable.
Thank you Zachary! Much appreciated.