APIs & Integrations

cinanoglu
Participant | Diamond Partner
Participant | Diamond Partner

How to combine external JavaScript files on COS

Hello,

I ran a speed test on Pingdom for a COS website and it says there are 7 JavaScript files (not 3rd party) should be combined. How can I achieve this? Any advice or guidance would be greatly appreciated!

Thank you!

0 Upvotes
4 Replies 4
Not applicable

How to combine external JavaScript files on COS

Hi @Derek_Gervais, I'm having a similar issue. Please see the Pingdom report for Render Blocking JS: https://tools.pingdom.com/#!/bSaiyY/https://www.portvision.com/

We've combined the code as much as we can, but we're running into issues with a few links still.

For example, a webpage may have five external or separate JS files like YouTube popup, sticky menu, etc. We combine all them in one file, but now our page is loading a CTA, so it called a new JS file (through HubSpot backend). So the issue is happening with our dynamic JS files, which we are unable to combine without breaking the page.

My question is, how can we further combine all the rest of the dynamic JS files into one (or fewer than currently)?

Please advise.

0 Upvotes
boulter
HubSpot Product Team
HubSpot Product Team

How to combine external JavaScript files on COS

Hi ccjesse,

Looking at your pingdom report, there's a number of custom files you could combine. Those are

As for the others, we are looking at loading the CTA js only once.

There is a Web Pages setting you can turn on that will load jQuery in the footer which will make it non-render blocking. You will need to verify that your pages don't use jQuery before the footer though.

The rest are all async scripts that should not block rendering.

txie
Member

How to combine external JavaScript files on COS

Hi boulter,I want to know How can I make JS load once。

0 Upvotes
Derek_Gervais
HubSpot Alumni
HubSpot Alumni

How to combine external JavaScript files on COS

Hi @cinanoglu,

Just to make sure that we're on the same page, are these your own custom JS files that you're hosting on the COS? If that's the case, I'd recommend just combining them to a single file in the COS.

0 Upvotes