Page counter | XM Community
Skip to main content

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

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.


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