Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

what will happens if i remove {{content_for_header}} from page?

what will happens if i remove {{content_for_header}} from page?

HassanKhanjaved
Shopify Partner
4 0 1

I'm new to Shopify and have been trying to optimise the performance for two days, but I've failed because the content_for_header object returns too many scripts (JavaScript). Now that I've removed content_for_header from one page, my page speed has improved. But I'm not sure what kind of scripts are returned by these objects or what effect they will have on the entire website if I remove them permanently.

Could you please tell me whether I should remove this? And what effect will these scripts have?

Second, can you tell me what the purpose of these scripts returned by the content_for_header object is and where I can learn more about their functionality? Or can I add attributes like defer to these scripts????

Replies 2 (2)

Jason
Shopify Partner
11206 226 2314

It's not something you want to remove unless you really, really know the impact. Removal could see things like accelerated payments, app code, tracking/reporting scripts not load. Not loading those can equal more speed (obviously, since you're loading less) but at the loss of functionality you likely want to keep to running the business.

Great that you're looking at speed but don't over index on that at the cost of core functionality for a commerce site.

★ 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 ★
HassanKhanjaved
Shopify Partner
4 0 1

Thank you for your response, but the problem is that content_for_header is injecting third-party code into the page . Could you please tell us what we should do to lessen the impact of third-party code? As shown in the image below, all of this content is returned by the content_for_header object.

question.PNG

 

Furthermore, Shopify does not provide a solution to the

deal with issues such as (serve static assets with efficient cache policy). 

cache.PNG

 

I believe that Shopify's services are so poor that we are forced to use third-party plugins to optimise speed.