Count number of "back button" uses | XM Community
Solved

Count number of "back button" uses

  • 10 August 2020
  • 4 replies
  • 104 views

Hello everybody,
I have study with multiple screens. I activiated the back button feature in general and then hided the back button for a majority of pages, besides two. For these, I would like to count the number of "clicks on the back button" for each participants. I tried using the standard "Timer", but it just continues recording where it stopped.
Can I count the number of clicks on the back button to measure how often a person went back?
Thanks in advance for any advice you can offer!
Kim

icon

Best answer by SurajK 10 August 2020, 19:37

View original

4 replies

Userlevel 5
Badge +4

Hi Kim_Boehm ,
You can achieve this using JS, first create the BackButton_cnt embedded variable at the start in survey flow and add the below JS code in Look & Feel -> General -> Header -> Source.
In the BackButton_cnt variable the count will get stored every time you hit the back button.

Hi SurajK,
thanks a lot for your super fast reply. I am not expert but this code counts the clicks on any back button in the survey, right?
So, if I have a back button on page 5 and page 10. On all other pages (1-4, 6-9, 11-15) I hide the back button.
Can I achieve the same with two variables counting the use of "back button 1" (page 5) and "back button 2" (page 10) seperately? More precisely, I am interesed in whether back button 1 is used more or less than back button 2. However, both buttons are just the " '.PreviousButton' " that is standard in Qualtrics and hided on some of the pages.
Thanks again,
Kim

Userlevel 5
Badge +4

Ok, so you are looking to count the backbutton click for the specific question, then you can simply create the 2 embedded variables as you mentioned above and use the above code at question level.
For page 5 use the below code,
Qualtrics.SurveyEngine.addOnReady(function()
{
jQuery('.PreviousButton').click(function(){
var currcnt1 = Qualtrics.SurveyEngine.getEmbeddedData("BackButton_cnt1")
currcnt1=Number(currcnt1) + 1
Qualtrics.SurveyEngine.setEmbeddedData("BackButton_cnt1",currcnt1)
});
});
And on page 10 use the below code,
Qualtrics.SurveyEngine.addOnReady(function()
{
jQuery('.PreviousButton').click(function(){
var currcnt2 = Qualtrics.SurveyEngine.getEmbeddedData("BackButton_cnt2")
currcnt2=Number(currcnt2) + 1
Qualtrics.SurveyEngine.setEmbeddedData("BackButton_cnt2",currcnt2)
});
});

Hi SurajK,
thanks a lot for your answer and effort! That is exactly what I searched for and it works perfectly!
Cheers,
Kim

Leave a Reply