5 second delay before async scripts are loaded. Why?

buildpath
Shopify Partner
59 11 20

I'm working on a client's store and  in theme.liquid, {{ content_for_header }}  is commented out.

 

  1. When loading the site, most of it loads quickly, but...
  2. Then there is a 5 second delay where nothing happens and no network requests from my browser to the server are waiting.
  3. Then most scripts are loaded, including some that really need to be loaded before 5 seconds have passed. 
  4. Strangely, the site has an A on GTMetrix for pagespeed score

When I uncomment {{ content_for_header }}, the delay disappears and everything loads in a reasonable time. However, the the GTMetrix score goes down to B and it shows a longer time to load the page. It's like something is adding a 5 second delay to make pagespeed tools like GTMetrix think the page finished loading already and gives a better score... THEN after that, all those async scripts get loaded.

Anyone encounter similar? I have never encountered this strange 5 second delay.

Ecom entrepreneur since 2004 | Shopify App developer since 2021 | Shopify merchant and theme developer since 2016
Replies 2 (2)

Jason
Shopify Expert
11194 225 2285

I've seen some dodgy speed tricks using loading delays to make a page appear faster to testing engines. Perhaps that's the case here with something you've inherited from a previous dev - worth looking at what scripts are actually loading early to see if one of those is doing something weird. Without seeing your example it's going to be lots of guessing and conjecture like this, so won't be a really helpful convo.

 

Are you able to share examples?

★ I jump on these forums in my free time to help and share some insights. Not looking to be hired, and not looking for work. http://freakdesign.com.au ★
buildpath
Shopify Partner
59 11 20

Hey Jason, thank you for the insights - that's what I feared. Client can't get details from the "pagespeed expert" he hired on Fiverr for this.  So I'm searching around the theme code for any such delays and will report back here for others' reference

Ecom entrepreneur since 2004 | Shopify App developer since 2021 | Shopify merchant and theme developer since 2016