Helping WPT not count a non dependent JS file towards page load times

An HTML5 game that we’re building for a client needs to have a Fully Loaded score from WPT of 5 seconds max. Our page currently loads a single JavaScript bundle and takes longer than that, so we’re going to split the game up into two parts: Assets for later parts of the game that the player doesn’t need at launch will be loaded asynchronously, so they can already use the main menu or even start the game quicker.

However, the two second rule seems to kick in here when WPT measures the Fully Loaded time. Unless we specifically wait a little over 2 seconds (2200 ms seems to do the trick), any way we load assets seems to count towards the initial page load time, since it’s detected as network activity. Even via script tag marked as async.

My question: Under our scenario, is there any way we can structure our code to avoid this page load time inflation in the WPT figure?

I can see how WPT can’t really tell that what is being loaded has no dependencies to the initial interactions of the game (page), so it has to do what it can to assume this counts towards the initial page load metric.

Delaying further asset loading for over 2 seconds is mostly fine, if we do this for content used by the later game levels. We would get some extra flexibility in how we structure things though if we could avoid that extra delay.

What’s the reason for the 5s max load time? You could use scripting to decrease this time eg:
setActivityTimeout 1000
navigate domainname.com

Here’s the link to the scripting documentation, hopefully they will update the documentation link in the menu soon:
https://github.com/WPO-Foundation/webpagetest-docs/blob/master/user/Scripting.md#end-conditions

The 5 second rule is simply part of their corporate standards. They’re a very big entity with lots of brands, and have a centrally managed standard for all their online content.

I’m not sure how your link relates here, Antony. The issue is that WPT has no way of knowing that a page has loaded to the point that it can be interacted with and that the timer should stop, even if it’s still prefetching a second JS bundle to be used later. If I don’t wait 2 seconds and ‘trick’ WPT into thinking the page has loaded, our load times are above 5 seconds because it counts the second bundle load time too.

In the end, we did managed to optimise the bundle size to the point where it does load in 5 seconds, so my initial problem is (almost) moot. I was just curious if others have run into the same issue before. In our case, telling the client ‘Oh yeah, that tool you use is not always accurate’ was not an option.

I say ‘almost’ moot, since once the game starts, it makes an API call for analytics, and guess what… that’s network traffic within 2 seconds, so it counts that too!
[hr]
Update: Ohhhhh. That docs link you sent does make sense to me now.

Unfortunately I am not sure we get to dictate what specific options they call it with. But it’s good to know this exists! Thanks for pointing me in the direction!