Often, libraries are loaded synchronously in the
<head> tag of a page. For example:
If the parser comes across the
Tag Management libraries can quickly grow large if you have a lot of tags to manage.
You can load any library asynchronously by adding an
async attribute to the
<script> tag. For example:
<script src="example.js" async></script>
As described above, in synchronous deployments, the browser pauses parsing and rendering the page while the Adobe Experience Platform Launch library is loaded and executed. In asynchronous deployments, on the other hand, the browser continues parsing and rendering the page while the library loads. The variability of when the Platform Launch library might finish loading in relation to page parsing and rendering must be taken into consideration.
First, because the Platform Launch library can finish loading before or after the bottom of the page has been parsed and executed, you should no longer call
_satellite.pageBottom() from your page code (
_satellite won’t be available until after the library has loaded). This is explained in Loading the Platform Launch embed code asynchronously.
Second, the Platform Launch library can finish loading before or after the
DOMContentLoaded browser event (DOM Ready) has occurred.
Because of these two points, it’s worth demonstrating how the Library Loaded, Page Bottom, DOM Ready, and Window Loaded event types from the Core extension function when loading a Platform Launch library asynchronously.
Let’s assume your Platform Launch property contains the following four rules:
Regardless of when the Platform Launch library finishes loading, all the rules are guaranteed to be executed and they will be executed in the following order:
Rule A → Rule B → Rule C → Rule D
Although the order is always enforced, some rules might be executed immediately when the Platform Launch library finishes loading, while others might be executed later. The following occurs when the Platform Launch library finishes loading:
DOMContentLoadedbrowser event (DOM Ready) has already occurred, Rule B and Rule C are executed immediately. Otherwise, Rule B and Rule C are executed later when the
DOMContentLoadedbrowser event occurs.
loadbrowser event (Window Loaded) has already occurred, Rule D is executed immediately. Otherwise, Rule D will be executed later when the
loadbrowser event occurs. Note that if you’ve installed the Platform Launch library according to the instructions, the Platform Launch library always finishes loading before the
loadbrowser event occurs.
When applying these principles to your own website, consider the following:
If you see things occurring out of order, it is likely that you have some timing issues to work through. Deployments requiring precise timing might need to use event listeners and the Custom Event or Direct Call event type to make their implementations more robust and consistent.
Platform Launch provides a toggle to turn on asynchronous loading when creating an embed code when you configure an environment. You can also configure asynchronous loading yourself:
Add an async attribute to the
<script> tag to load the script asynchronously.
For the Platform Launch embed code, that means changing this:
<script src="//www.yoururl.com/launch-EN1a3807879cfd4acdc492427deca6c74e.min.js?lang=en" async></script>
Remove any code you may have previously added at the bottom of your tag:
This code tells Platform Launch that the browser parser has reached the bottom of the page. Because Platform Launch likely will not have loaded and executed before this time, calling
_satellite.pageBottom() results in an error and the Page Bottom event type may not behave as expected.