We often get the question "my web developer says the ActiveDEMAND tracking script is making my page slow to load, does your script slow down my site?". Often web developers will reference a waterfall diagram which will show that the ActiveDEMAND tracking script takes time to load, thus the inference is that the page is being blocked by the tracking script. In reality, the tracking script does not impact page load speed. The tracking script is a tiny file that is loaded asynchronously. The default deployment of the tracking script is async, defer. You can read about this here
From the above page
- Scripts with
defernever block the page.
- Scripts with
deferalways execute when the DOM is ready (but before
async attribute means that a script is completely independent:
- The browser doesn’t block on
- Other scripts don’t wait for
asyncscripts don’t wait for them.
DOMContentLoadedand async scripts don’t wait for each other:
DOMContentLoadedmay happen both before an async script (if an async script finishes loading after the page is complete)
- …or after an async script (if an async script is short or was in HTTP-cache)
||Load-first order. Their document order doesn’t matter – which loads first runs first||Irrelevant. May load and execute while the document has not yet been fully downloaded. That happens if scripts are small or cached, and the document is long enough.|
||Document order (as they go in the document).||Execute after the document is loaded and parsed (they wait if needed), right before
This implies that the page load happens regardless of whether the tracking script is fully loaded on the page.