Custom api to update the data

I want to update this number through client’s api :

where should I put the script code?


      function getPrintCount(){
              url: '',
              dataType: 'json',
              type: 'get',
              cache: false,
              success: function(data){
                  document.getElementById("printCount").innerHTML = data.count;
              error: function(data){
                  document.getElementById("printCount").innerHTML = '0';

Hi @yuenletsgo, I woud put that in the Before Body section of custom code in project settings or in page settings. Here are some good resources:

Using custom code in the head and body:

Using custom code in an embed component on the page:

That code appears to be targeting an element having an ID of “printCount” so make sure there is an element on your page having that matching ID.

I hope this helps

1 Like