This is an archived forum post. The information may be outdated. Contact us if you have any questions.

setJavascriptDelay

rkarlberg wrote on 2018-12-08:
I'm curious about how to set the setJavascriptDelay parameter. I had it set to 1000, and my reports worked most of the time, but sometimes they would come out empty. So I had to subscribe to the next level, but at 2000 my reports were still empty. I upgraded again, and they worked great at 3000. Then, just as a test I tried 1000 again, and they were still working.

Is there any guidance on ways we can maximize our usage of this delay time, without having to pay hundreds of dollars a month?
support wrote on 2018-12-10:
The delay countdown starts after the onload event is fired. Try to do as much as possible before this event occurs (see e.g. here).

We also recommend that you insert a hidden element into the DOM after you consider the page loaded and wait for that element to show up with setWaitForElement(). This will cause that the conversion will start as soon as the element is found instead of waiting for the delay period to pass. Also, the API returns an error if the element is not found so you at least know that the page was not converted properly.
OrlandoKel wrote on 2019-03-05:
Does it matter what kind of hidden element you put into the DOM?
support wrote on 2019-03-05:
It doesn't matter.

E.g. add the following element <span id='html-finished'></span> as the last action of your Javascript
and use API method
client.setWaitForElement('#html-finished')