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.