Page counter | XM Community
Question

Page counter

  • 17 April 2023
  • 2 replies
  • 241 views

Userlevel 5
Badge +7

Hi!

 

I want to add a page counter to a survey but it isn't working.

I have this css code

.PageNumber::before {
    content: "Page " counter(page) " of " counter(pages);
}


2 replies

Userlevel 7
Badge +20

You can use embedded data to increment the count on every page load (if user click on next button) likewise if you have previous button then you can decrement the count and then use the embedded data as a pipe-text in the footer.

Userlevel 7
Badge +27

Hi, following MohammedAli_Rajapkar’s recommendation, first create an Embedded Data element “n” at the top of the Survey Flow and set its value to 1. Then, add the below to the survey’s Header:

Page Number: <h class="counts"></h>
<script>
var n = parseInt("${e://Field/n}");
jQuery(".counts").html(n);

jQuery("#PreviousButton").click(function() {
Qualtrics.SurveyEngine.setEmbeddedData("n", n-1);
});

jQuery("#NextButton").click(function() {
Qualtrics.SurveyEngine.setEmbeddedData("n", n+1);
});
</script>

 

Leave a Reply