Page Speed: render-blocking JS from Hubspot CDN, can I use async attribute?

SOLVE
Occasional Contributor

Running our website through Google Pagespeed Insights, we're getting dinged heavily for 'render-blocking JavaScript' on tags referring to resources such as the following: 

 

https://static.hsstatic.net/…y-libs/static-1.1/jquery/jquery-1.7.1.js

https://cdn2.hubspot.net/…file-1390590330-js/Streamlined_2/slab.js
https://cdn2.hubspot.net/…mlined_2/colorbox/jquery.colorbox-min.js
https://cdn2.hubspot.net/…98925/file-949047520-js/jquery.cookie.js
https://cdn2.hubspot.net/…-1321087991-js/Streamlined_2/countify.js
https://cdn2.hubspot.net/…065007-js/Streamlined_2/jquery.easing.js

 

To increase speed of rendering, is it advisable to asynchronously load this list of resources?

 

Also, we are seeing a number of redirects to display ad exchanges like Doubleclick, OpenX, adnxs.com, and Rubicon Project. Is anyone aware of why these un-related domains are being called in our pageloads and, if so, if they are necessary? We would like to eliminate them if possible.

 

Thanks in advance!

1 Accepted solution

Accepted Solutions
Advisor

@tinypulse you can't edit the jQuery script tag because it's part of the standard_header_includes. If you're adding jQuery then you can remove it because it's already in the head of the site.

--
Stefen Phelps
Web Developer / Co-founder
Kelp Creative Agency
Twitter — @stefen
11 Replies 11
Advisor

you cannot remove jQuery from a HubSpot hosted site. The other scripts you should be able to async (or move to the footer, or both) either in your template itself or in the site's content settings, depending on where they currently live.

--
Stefen Phelps
Web Developer / Co-founder
Kelp Creative Agency
Twitter — @stefen
Occasional Contributor

Stefen, understood - would you recommend adding async to the tag calling jQuery?

Reply
0 Upvotes
Advisor

@tinypulse you can't edit the jQuery script tag because it's part of the standard_header_includes. If you're adding jQuery then you can remove it because it's already in the head of the site.

--
Stefen Phelps
Web Developer / Co-founder
Kelp Creative Agency
Twitter — @stefen
Occasional Contributor

@stefen Are those really the only two options, either adding jQuery to the header and removing the JS tag or leave it as is? Currently our site tinypulse.com is spending a great deal of time on this process, so we're looking to speed it up. Thanks!

Reply
0 Upvotes
rix
New Contributor

I am curious about this as well. This looks to be something Hubspot would need to do on their end. Block Rendering javascript\css files would be trial by error as you would not want to block a resource that is parsing the dom while rendering your site UX. You wouldnt want to willy-nilly render block everything Google speed test tells you to.

 

 

Regular Contributor

A bit of a different issue but similar, Hubspot calls an older form of Jquery, is there specific advice for calling Hubspot's main Jquery and the newer version on the same page? This is a problematic part of development for most using Jquery's new features. 

Reply
0 Upvotes
Regular Contributor

I have similar problem, google insights shows the problems with rendering:

https://static.hsstatic.net/…-libs/static-1.4/jquery/jquery-1.11.2.js

https://static.hsstatic.net/…sets/static-1.4049/css/public_common.css

 

Why jquery is included in the header instead of the footer and why it is not possible to delete/uncheck the jquery from header and include it in the footer?

It is quite big issue if I can not optimize my website.

Reply
0 Upvotes
Regular Contributor

You can check this post: https://community.hubspot.com/t5/Content-Design-Questions/How-do-I-disable-JavaScript-and-CSS-render...

and my answer how to remove .js and .css from HubSpot pages.

Reply
0 Upvotes
Occasional Contributor

Go to Settings > Website > Pages and scroll the jQuery Section at the bottom of the page. There is a checkbox you can select and the save. This will place the jQuery script at the bottom of your page, above the rest of the js files and inline code that HubSpot injects.

Highlighted
jly
Occasional Contributor

I tried this out on our site. Did a google page speed test before and after trying this solution. We lost 5 "points" when I tried your solution. In theory, it seems like it should work, but it just made it slower. Had to revert it.

 

Any solution, @Hbuspot?

Reply
0 Upvotes
Occasional Contributor

If Hubspot thinks this is the solution - half of your "how to keep the customer happy articles" are null and void. You should stop writing those articles. 

 

THIS IS A VERY BIG PROBLEM AND ALMOST EVERY WEB DEVELOPER IS CRYING TO PROVIDE A FIX. SOMEHOW HUBSPOT CANNOT PROVIDE A FIX TO WHERE EVERYONE ELSE EXCEPT HUBSPOT HAS A MARKET STANDARD SOLUTION.

 

AS A DEVELOPER I AM SAYING IT WILL TAKE HALF DAY TO FIX THIS FOR ANY NORMAL JAVASCRIPT DEVELOPER AND MAINTAIN BACKWARD COMPATIBILITY.

 

YOU BULT AN AWESOME GIGANTIC PLATFORM. DON'T BLOW UP ON THESE TRIVIAL SILLY ISSUES.

 

IF YOU DONT KNOW HOW TO - CALL US - GLAD TO GUIDE YOU.